Search code examples
phpphp-ziparchive

ZipArchive problem to extracting zip files that have been downloaded from linux server


ZipArchive can not extract files when i download a zip file from a linux server. when I extract files manually and compress them again in windows, then there is no problem.

it seem that could be a problem with line ending in linux and windows zip files.

$zip = new ZipArchive;
$zip->open('test.zip'); // zip file has been download from a linux server
$zip->extractTo('./');
$zip->close();

any suggestion ?


Solution

  • Downloaded file was corrupt because of sending invalid Content-Type header