You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by pritesht <pr...@forindia.com> on 2000/08/18 04:59:09 UTC

file download with mod_perl

I am using following script in perl to download a file from the server to the local machine. The great thing about this code is, it populates a file save as dialog. The dialog is populated becuase of "Content-type:application/unknown\n Content-disposition:attachment;filename=$filetobedownloaded\n\n".
 
 
my ($in) = new CGI;
my ($filetobedownloaded)  = $in->param('filetobedownloaded');
my ($working_dir) = $in->param('wd');
 
print "Content-type:application/unknown\n Content-disposition:attachment;filename=$filetobedownloaded\n\n"
my $directory = "$config{'root_dir'}/$working_dir";
 
open (OUTFILE, "$directory/$filetobedownloaded");
binmode OUTFILE;
binmode STDOUT;
 
while (<OUTFILE>) { 
 $in->print($_); 
} 
close (OUTFILE); 

 
However, the same code is not working under mod_perl. The file content is the same as original file, but filename is populated as download.cgi instead of actual file name. I think mod_perl is putting its own headers, while sending the data.
 
Any help will be greatly appreciated.

Thanks,
Pritesh.
pritesht
e-mail: pritesht@forindia.com




--------------------------------------------------------

Feed  Your Greed !!!
Get your 10MB Free space only at http://www.forindia.com NOW!

--------------------------------------------------------