THRAK has asked for the wisdom of the Perl Monks concerning the following question:
Once I get this working, I would like to try to stream the data directly from the data array from which the CSV file is created. Assuming that I can get the download pop-up dialog to function, I would think I should be able to do that. Yes?sub download_file { my ($filename) = @_; my $filesize = -s $filename; # print full header print "Content-disposition: inline; filename=$filename\n"; print "Content-Length: $filesize\n"; print "Content-Type: application/octet-stream\n\n"; # open in binmode open(READ,$filename) || die; binmode READ; # stream it out binmode STDOUT; while (<READ>) { print $_; } close(READ); # should always return true return(1); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: Web Initiated File Download
by Ovid (Cardinal) on Sep 07, 2001 at 00:23 UTC | |
by THRAK (Monk) on Sep 07, 2001 at 19:16 UTC | |
by Ovid (Cardinal) on Sep 07, 2001 at 19:48 UTC | |
|
Re: Web Initiated File Download
by $code or die (Deacon) on Sep 07, 2001 at 07:06 UTC |