whether due to the size of one file or due to the number of files
"the number of files" - as in "the number of files within the archive", right? Because
download() only handles one file at a time.
Any clues ?
Come to think of it, this could be a server configuration issue (google
"mod_gzip" OR "mod_deflate" zip corruption).
What happens if you put a (preferably large) ZIP archive somewhere within the document root and download it using the direct link?
Well, anyway, try this slightly modified version of download:
sub download {
my $filename = $_[0].$_[1];
use CGI;
$html=new CGI;
$| = 1;
print $html->header(
-type => 'application/zip',
-charset => 'binary',
-attachment => $_[1],
-Content_length => -s $filename);
open($peunter, "<", $filename);
binmode($peunter);
binmode STDOUT;
while (read($peunter,$bytes,1024)) {
print $bytes;
}
close($peunter);
}