Getting corrupted or empty zip by ZipArchive php
Try getting the full file path and name just before $zip->close();
$filename = $zip->filename;
And use that instead of $zipname
when reading the file and getting the file size
This is my best guess. What's going wrong here is that in your array $files
the values you're storing are probably not actual paths to files.
Remember: You can't pass URLs into $zip->addfile()
, you need your actual files.