if(!empty($this->request->post['product_category'])) {
$product_image = $this->model_account_download->getImage($this->request->post['product_category']);
foreach ($product_image as $image) {
$fileName = basename($image['image']);
$filePath = 'image/' . $fileName;
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=$fileName");
readfile($filePath);
}
}
Так получается выгрузить только одну картинку, если возможность выгрузить все картинки zip архивом ? или что бы выгружались все картинки ?
Создаем архив с файлами
$files = array('file1.jpg', 'file2.jpg', 'file3.jpg');
$zipname = 'images.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='.$zipname);
header('Content-Length: ' . filesize($zipname));
readfile($zipname);
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости