use IO::Compress::Zip qw(:all); my @files = ('example.gif', 'example1.png', 'example2.jpg', 'example3.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;