#!/usr/bin/perl use warnings; use strict; my $boundary_string = "\n" . "--End" . "\n"; my $end_of_data = "\n" . "--End--" . "\n"; my @file_list = ("test.tgz","test1.tgz","test2.tgz"); print<<EOH; Content-type: multipart/x-mixed-replace\;boundary=End EOH foreach my $file (@file_list){ &send_file ($file); print $boundary_string; } print $end_of_data; exit(0); sub send_file { my $file = $_[0]; if (open (FILE, "< $file")) { print<<EOF; Content-type: application/octet-stream Content-Disposition: attachment\; filename=$file EOF binmode FILE; print <FILE>; close (FILE); }else{print "Cannot open file $file!"} }
In reply to cgi-multi-download by zentara
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |