I am creating a zip file in PHP using the following:
$zipfilename = "/myzip.zip";
$mp3path = "/path/to/mp3-files/";
echobr($zipfilename);
if(!is_file($zipfilename)) {
$zip = new ZipArchive();
if ($zip->open($zipfilename, ZipArchive::CREATE) !== TRUE) {
echo("cannot open <$filename>n");
} else {
foreach($mp3Album as $a) {
if(is_file($mp3path.$a['file'])) {
$zip->addFile($mp3path.$a['file']);
}
}
$zip->close();
echo(var_export(is_file($zipfilename),1));
}
}
The zip gets created, however when I download it and double click to view it in Windows 10, it states this folder is empty.
If I right click and select ‘Extract All..’ and try and extract it, I get the message: The file is invalid
.
However 7Zip will extract it no problem.
What am I doing wrong that windows cannot handle this file?
Source: Windows Questions