in reply to (Ovid) Re: Web Initiated File Download
in thread Web Initiated File Download
sub download_file { # REF: http://www.perlmonks.org/index.pl?node_id=110714&lastnode_id +=3628 my ( $send_file, $send_name, $mime ) = @_; die "$send_file does not exist." unless ( -e $send_file ); my $filesize = -s $send_file; print $query->header(-type=>$mime, -Content_disposition=>"attachment; fil +ename=$send_name", -Content_Length=>"$filesize" ); # open in binmode open READ, "< $send_file" or die "Cannot open $send_file for readi +ng: $!"; binmode READ; binmode STDOUT; # stream it out { local $/; print <READ>; } close(READ); return(1); # should always return true }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re(3): Web Initiated File Download
by Ovid (Cardinal) on Sep 07, 2001 at 19:48 UTC |