Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Downloading a .exe file with Apache and Perl

Thread Tools

Downloading a .exe file with Apache and Perl

Posts: n/a
I am using the next Perl Script to download a .exe file:

The file can be download complete (well almost: Opera send a error
when the download finishes) by the brownser but it arrives corrupted.
I mean it canīt be executed. It is windows application and when a
execute the downloaded file appears a DOS window, which send the error
message "The file can't be executed in DOS mode".

I don't know if I am not generating the apropiate headeres with the
Perl Script or if I need configurate something with Apache

-Text files can be download well with the script.

#!E:\Perl5p8p8\bin\perl.exe -wT

use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser);

my $file_location;
my $filename;
my $filesize;
my @fileholder;

$file_location = "D:\\MiSitioWEB\\SPE\\cgi-bin";
$filename = 'Setup.exe';
$filesize = -s "$file_location\\$filename";

open(DLFILE, "<$file_location\\$filename") ||
@fileholder = <DLFILE>;
close (DLFILE) || Error ('close','file');

print LOG "$filename\n";

print "Content-length: $filesize\n";
print "Content-Type:application/x-download\n";
print "Content-Disposition:attachment;filename=$filename\n\n";
print @fileholder;
sub Error
print "Content-type: text/html\n\n";
print "El servidor no puede $_[0] el $_[1]: $! \n";

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PERL can't open file for logging (world writable directory Windows XP Home/ Active Perl / Apache) PGPS Perl Misc 10 11-14-2006 01:40 AM
AXIS jars org.apache.axis.wsi.* and org.apache.axis.transport.jms.* Java 0 02-23-2005 04:02 PM
Use perl in apache without #!/path/to/perl Kostas Hatzikokolakis Perl Misc 2 10-19-2003 03:02 AM
How to test speed difference of Perl/Apache and SSI/Apache The Poor Perl Misc 2 09-27-2003 12:26 PM
Problem executing a BAT file (or EXE file) using Perl as CGI script under Apache. Tom Salzmann Perl Misc 3 07-16-2003 01:06 PM