W3C home > Mailing lists > Public > www-jigsaw@w3.org > July to August 2000

File download with mod_perl

From: Pritesh Thakor <pritesht@123india.com>
Date: Thu, 17 Aug 2000 05:52:22 -0400 (EDT)
Message-ID: <012101c00831$8983a660$4f1136ca@akshay.co.in>
To: <www-jigsaw@w3.org>
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 regarding this, will be greatly appreciated.

Thanks,
Pritesh.
Received on Thursday, 17 August 2000 06:00:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:34 GMT