471,887 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

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 1810
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 YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.