in reply to Multi file stream with IO::Compress::Zip

This is what I created and works for me. When user opening some URL on my page I am creating ZIP archive on the fly and sending it to user.

If change "-" to "file.zip" it will save archive into your hosting/server (and don't need print "content type").

use IO::Compress::Zip qw(:all); my @files = ('example.gif', 'example1.png', 'example2.jpg', 'exampl +e3.avi', 'example4.mov'); my $path = "/home/********/**********"; print "Content-Type:application/zip\n"; print "Content-Disposition: attachment; filename=\"filename.zip\"\n +\n"; my $z; foreach my $file (@files) { if ($z) { $z->newStream(Name => $file, Method => ZIP_CM_STORE); } else { $z = new IO::Compress::Zip "-", Name => $file, Method => ZIP_ +CM_STORE; } open(FILE, "<", "$path/$file"); binmode FILE; my ($buf, $data, $n); while (($n = read FILE,$data, 1024) != 0) { $z->print($data); } close(FILE); } $z->close; exit;