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 gather all the files from "images/" folder, except "generate_zip.php", and make it a downloadable .zip? In this case the "images/" folder always have a different image. Is that possible?
includes all sub-folders:
new GoodZipArchive('path/to/input/folder', 'path/to/output_zip_file.zip') ;
at first, include this piece of code.