| Posted by Paul Lautman on 07/29/07 10:37 
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_MySQL_and_PHP_to_Present_Excel_Spreadsheets/20/26896/
  Navigation: [Reply to this message] |