By original I mean the one from the file when it was archived.
I know the info is in the zip archive, because when unzipping the archive in Windows, for example, you get the original files' information (last modification date, creation date, and such).
But when extracting the file with ZipArchive::extractTo
, its modification date is set to the time of the extraction (which makes some logic), and I cannot read it anymore.
I've seen bits of code using ZipArchive::getStream
and stat()
but I still get an "altered" date, not the original one.
Is there any built-in functions set that could help me with this ? (I'm on a web host and cannot install much)
I have made searches on Google, have often ended up here, have made some more searches here, but could not find precisely what I needed. If there already is a thread addressing this, please simply point me to it and close this one.
Thanks in advance for any constructive input :-p
For later use, answer with proper formatting :
$zipTmp = new ZipArchive();
$res = $zipTmp -> open("archive.zip");
$info = $zipTmp -> statname("path/to/file/inside/archive.zip");
echo date("YmdHi", $info["mtime"]);