Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

corrupted .exe

Status
Not open for further replies.

yeller2

Programmer
Feb 8, 2007
69
US
Hello,

I'm trying to transport an .exe file via http from my cgi to the browser. I set the cgiheadercontenttype to application/octet-stream. I am able to successfully open the original file, but unable to do so with the .exe I download via the browser. It appears the downloaded version is corrupted, it is also 38 bytes larger than the original - an ideas?

Thanks
 
how are you transferring it to the server? Are you doing it via ftp in BIN mode?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
I actually tried transferring it another way, but I tried your sugg. and that doesn't seem to work for me.

Thanks
 
I've tracked down the issue to be the Content-disposition part of my header. I want to use this so I can return a filename, but removing it completely causes my .exe to run successfully - any ideas?
 
Alright, I'm stuck. Is there any other way to provide a user with a file from the server?
 
If this is a Windows server, make sure you write the EXE in binary mode.

Code:
#!/usr/bin/perl -w

open (EXE, "file.exe");
binmode EXE;

binmode STDOUT;
print "Content-Disposition: attachment; filename=file.exe\n";
print "Content-Type: application/octet-stream\n\n";

while (<EXE>) {
   print;
}

-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top