/* create zip folder */
public function zip(){
$getImage = $this->cart_model->getImage();
$zip = new ZipArchive;
$auto = rand();
$file = date(“dmYhis”,strtotime(“Y:m:d H:i:s”)).$auto.’.zip’;
if ($zip->open(‘./download/’.$file, ZipArchive::CREATE)) {
foreach($getImage as $getImages){
$zip->addFile(‘./assets/upload/photos/’.$getImages->image, $getImages->image);
}
$zip->close();
$downloadFile = $file;
$download = Header(“Location:http://localhost/projectname/download/”.$downloadFile);
}
}