ZIP all files in directory and download generated .zip

Well, first of all, this is my folder structure: images/ image1.png image11.png image111.png image223.png generate_zip.php And this is mine generate_zip.php: <?php $files = array($listfiles); $zipname = 'adcs.zip'; $zip = new ZipArchive; $zip->open($zipname, ZipArchive::CREATE); foreach ($files as $file) { $zip->addFile($file); } $zip->close(); header('Content-Type: application/zip'); header("Content-Disposition: attachment; filename='adcs.zip'"); header('Content-Length: ' . filesize($zipname)); header("Location: adcs.zip"); ?> How to … Read more