0

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

1 Answers1

2

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);
Jenson M John
  • 5,499
  • 5
  • 30
  • 46
  • Thank you bro. Well i'm not really great at coding so how would i impliment this to the site? I'm using wix by the way – user3075447 Dec 06 '13 at 18:09
  • @user3075447 You're Welcome..I think you've to check the basics of eCommerce site to implement your requirement. Thanks..:) – Jenson M John Dec 07 '13 at 07:18