469,579 Members | 1,098 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

Strange download script problem

I have a php script which generates a zip file that contains an ASCII
text file. The script then prompts the user to save/open the zip file.
The script is on a server that is behind an Apache proxy server. Using
Firefox, the download works fine and everything goes as intended.
However, IE7 tries to download the php script instead of the zip file,
resulting in an access error.

Below are the pertinent portions of the script.

Any help is greatly appreciated.

Raffi

--------------------------------------------------------------------------------------------------------

$file_name = "/tmp/Export.zip";

$size = filesize($file_name);

//Set headers
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=Export.zip");
header("Content-Length: $size");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");

//Read the file from disk
readfile($file_name);

Jul 29 '07 #1
2 1763
Raffi wrote:
I have a php script which generates a zip file that contains an ASCII
text file. The script then prompts the user to save/open the zip file.
The script is on a server that is behind an Apache proxy server. Using
Firefox, the download works fine and everything goes as intended.
However, IE7 tries to download the php script instead of the zip file,
resulting in an access error.

Below are the pertinent portions of the script.

Any help is greatly appreciated.

Raffi

--------------------------------------------------------------------------------------------------------

$file_name = "/tmp/Export.zip";

$size = filesize($file_name);

//Set headers
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=Export.zip");
header("Content-Length: $size");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");

//Read the file from disk
readfile($file_name);
See
http://www.evolt.org/article/Using_M...eets/20/26896/
Jul 29 '07 #2
This is similar to your case:

http://in.php.net/manual/en/function.header.php#73416

On Jul 29, 10:46 am, Raffi <thegrizz...@yahoo.comwrote:
I have a php script which generates a zip file that contains an ASCII
text file. The script then prompts the user to save/open the zip file.
The script is on a server that is behind an Apache proxy server. Using
Firefox, the download works fine and everything goes as intended.
However, IE7 tries to download the php script instead of the zip file,
resulting in an access error.

Below are the pertinent portions of the script.

Any help is greatly appreciated.

Raffi

--------------------------------------------------------------------------------------------------------

$file_name = "/tmp/Export.zip";

$size = filesize($file_name);

//Set headers
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=Export.zip");
header("Content-Length: $size");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");

//Read the file from disk
readfile($file_name);

Jul 29 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Kornelius Finkenbein | last post: by
2 posts views Thread by Markus Franz | last post: by
2 posts views Thread by siggy2 | last post: by
14 posts views Thread by James Wong | last post: by
1 post views Thread by Melissa | last post: by
3 posts views Thread by Chuck Renner | last post: by
1 post views Thread by Blackstar | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.