همه موارد بالا رو چک کردم ولی ایرادی نداره !
کدش این هست:
path = "D:/new";
ini_set("max_execution_time", 300);
$zip = new ZipArchive();
if ($zip->open($path . "/my_zip.zip", ZIPARCHIVE::CREATE) !== TRUE)
{
die ("Could not open archive");
}
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path . "/"));
foreach ($iterator as $key=>$value)
{
if ($zip->addFile(realpath($key), $key)) or die ("ERROR: Could not add file: $key");
}
$zip->close();
$file = $path . '/my_zip.zip';
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-type: application/pdf");
header('Content-length: '. filesize($file));
header('Content-disposition: attachment; filename='.basename($file));
readfile($file);
unlink($file);