jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:
I have a script which is to handle a 'download once' mechanism for delivering a file. Everything else is working fine, but I need to have the script deliver the file anonymously. The file is about 24mb. I have this snippet (based on CGI Programming with Perl, 2nd ed p 314):
When I get to this point in my script the browser window goes blank, but I do not get the usual "Open or Save" dialogue fomr the browser. Any help greatly appreciated.use constant BUFFER_SIZE => 4096; my $file_directory = '/home/goldcal/www/files/'; my $buffer = ""; my $file = $file_directory . '/wlmlm401.exe'; print $cgi->header( -type => "application/exe", -expires => "-1d" +); #local *FILE; open (FILE, "<$file") or die "Cannot open file $file: $!"; binmode ( STDOUT ); binmode ( MY_FILE ); while( read( MY_FILE, $buffer, BUFFER_SIZE ) ) { print $buffer; } close FILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting CGI script to send a binary file
by saskaqueer (Friar) on Feb 08, 2005 at 06:26 UTC | |
|
Re: Getting CGI script to send a binary file
by prowler (Friar) on Feb 08, 2005 at 04:03 UTC | |
|
Re: Getting CGI script to send a binary file
by jdtoronto (Prior) on Feb 08, 2005 at 04:57 UTC | |
by graff (Chancellor) on Feb 08, 2005 at 05:10 UTC | |
|
Re: Getting CGI script to send a binary file
by dws (Chancellor) on Feb 08, 2005 at 04:15 UTC | |
by jdtoronto (Prior) on Feb 08, 2005 at 04:32 UTC | |
by graff (Chancellor) on Feb 08, 2005 at 05:02 UTC |