I have this ecommerce site that deals with digital downloads, but the user has to download items one at a time. How could i let them add various items to a cart then let them download the items they chose as one zip? is that possible?
Thanks, Ja art
I have this ecommerce site that deals with digital downloads, but the user has to download items one at a time. How could i let them add various items to a cart then let them download the items they chose as one zip? is that possible?
Thanks, Ja art
It's Possible With ZipArchive class to create a ZIP file.
$files = array('file1.pdf', 'file2.doc', 'file3.flv');
$zipname = 'file.zip';
$zip = new ZipArchive;
$zip->open($zipname, ZipArchive::CREATE);
foreach ($files as $file) {
$zip->addFile($file);
}
$zip->close();
To stream it:
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename=filename.zip');
header('Content-Length:'.filesize($zipname));
readfile($zipname);