in reply to CGI pdf got 0 bytes after downloading - compression problem?
Hi,
allow me to add some comments:
open FILE, "<", $MyPDF; binmode FILE;
binmode STDOUT; # read the whole file my $file = do { local $/ = undef; <FILE> }; my $length = length $file # additional header print "Content-Length: $length\r\n"; print "\r\n"; # http header end print $file;
Sending the content-length to the client has the advantage that the client can give you a forecast about the remaining time of download. Test it with a BIG pdf file. You'll see the difference.
Regards
McA
|
---|