Answer the question
In order to leave comments, you need to log in
How to save several pictures in a folder in an archive using PHP?
It is necessary to push several images (from 1 to n) into an archive created through the ZipArchive class. The archive itself with the excel file is created correctly. When I start writing images to the archive, it does not create the archive explicitly, uploading a broken file of 1 byte.
if($res === TRUE){
$zip->addFile($file_1);
$zip->addFile($file_2);
$zip->addEmptyDir('photo_drivers');
for($l=0;$l<count($img_array);$l++){
$zip->addFile($img_array[$l][key($img_array[$l])]['photo'][0],"photo_drivers/".key($img_array[$l]).".jpg");
}
$zip->close();
return $name_zip;
} else {
return "error ".$res;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question