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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

readfile problem

Status
Not open for further replies.

bont

Programmer
Joined
Sep 7, 2000
Messages
200
Location
US
Hi all, I am trying the following code:

Code:
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; Filename=".basename($filename).";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
readfile("$filename");

My problem is that this works fine for zip files, but when I use an .exe file, it appears to download the same amount of bytes using ws-ftp; however, it's proper icon is not visible and it will not execute properly.

I would think this to be due to one of the settings? Any suggestions?

I really haven't found a good, easy to use reference for the header statements. If someone can point me in a good direction, thanx.
 
ws-ftp is a popular ftp client. I can download my file from the ftp using it. I can also download the file using my php code. When I look at both files through the file listing of ws-ftp it sees the same size file, but the one downloaded using readfile doesn't work. The one downloaded using ws-ftp works fine.

Please does anyone see why the code posted wouldn't download a .exe file properly to the point that the icon does not display for the file and the file won't execute properly?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top