Tbone3434
asked on
PERL Download Script
Helllo, I have written a simple PERL script to download a file and when executed it prints the results and does not pop up the download box in Internet Explorer. This does however work just fine in Firefox as the download box pops up and downloads the file just fine. Any ideas?
#!/usr/bin/perl
use CGI;
#use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser);
my $files_location;
my $ID;
my @fileholder;
$files_location = "/home/httpd/html/perl_downloads/";
#$ID = param('ID');
$ID = 'name.csv';
#if ($ID eq '') {
#print "Content-type: text/html\n\n";
#print "You must specify a file to download.";
#} else
{
open(DLFILE, "<$files_location/$ID") || Error('open', 'file');
@fileholder = <DLFILE>;
close (DLFILE) || Error ('close', 'file');
open (LOG, ">>/home/httpd/html/perl_downloads/log.txt") || Error('open', 'file');
print LOG "$ID\n";
close (LOG);
print "Content-Type:application/x-download\n";
print "Content-Disposition:attachment;filename=$ID\n\n";
print @fileholder;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER