I use PHP zip function to extract files from a zip file
$zip = new ZipArchive;
if($zip -> open ($filezip) === TRUE ) {
$mani = $zip -> getFromName('MANIFEST.MF');
echo $mani;
}
This script will extract the file MANIFEST.MF, but i have a problem, that if i rename this file to MANIFEST.Mf or mANIFEST.MF (with lowercase) from the zip file, it couldn't be extracted
Please help me to fix this code.Thanks
ZipArchive
treats filenames from the archive case-sensitive, as do most Unix zip
utilities. So does ->getFromName()
You can only influence that behaviour for ->locateName()
with the ZIPARCHIVE::FL_NOCASE
flag.
echo
$zip->getFromIndex(
$zip->locateName('maNIFest.mF', ZIPARCHIVE::FL_NOCASE);
);