i created with php zip ( http://php.net/manual/de/book.zip.php ) a zip file
now i have to send it to the browser / force a download for it.
Google Chrome saves zip files as zip file by default. If not, you can right-click the zip-file link (if you have a right mouse button). It will say, "save link as".
<?php
// or however you get the path
$yourfile = "/path/to/some_file.zip";
$file_name = basename($yourfile);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=$file_name");
header("Content-Length: " . filesize($yourfile));
readfile($yourfile);
exit;
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With