Do you get the same result by sending instead the following header :
header("Content-Disposition:inline; filename=test.zip");
I have got round this filename thing to some extent using .htaccess / mod_rewrite to wildcard the requested name for a directory, passing the parameters in the URL to the PHP script as a query string (the PHP script then loads the requested file and passes it to the browser with the correct headers).
Now for my problem :
I have a similar scenario, but I can't get IE6 to download the file verbatim (in this case its a dynamically generated ZIP file). Netscape 4 behaves just as expected. The file is being dished up okay (I am getting a 200 response from the server)
With IE6, the download popup appears with the correct filename, but then I get 'IE cannot download (filename) from (hostname)'. I am sending headers as follows :
header("Expires:Tue, 20 Oct 2003 21:14:41 GMT",true);
header("Content-type:application/octet-stream");
header("Content-disposition: attachment; filename=test.txt");
header("Content-length:".strlen($zipout->file()));
Now, two things are happening :
1/ I get the error as mentioned above
2/ Checking the raw headers with telnet, I get the following output : Note the 2 'expires' headers which are being sent.
HTTP/1.1 200 OK
Date: Mon, 13 Jan 2003 22:00:52 GMT
Server: Apache/1.3.14 (Win32)
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Thu, 19 Nov 1981 08:52:00 GMT, Tue, 20 Oct 2003 21:14:41 GMT
Pragma: no-cache
X-Powered-By: PHP/4.0.5
Set-Cookie: PHPSESSID=209662eebd6b5b150815f0edbbb96da4; path=/
Content-length: 2152
Connection: close
Content-Type: application/octet-stream
The PHP manual states optional parameter 'true' after a header will replace the existing header. This doesn't seem to be working in this case on the Expires header - which I suspect of causing my 'Cannot download' problem
Is this a limitation or known bug in PHP4.0.5 ? Else, I have missed something obvious, perhaps somebody can give me a pointer :-)
Cheers,
Neil Smith.
At 20:08 13/01/2003 +0000, you wrote:
Message-Id: <[EMAIL PROTECTED]>
Date: Mon, 13 Jan 2003 11:47:14 -0500
To: [EMAIL PROTECTED]
From: Aaron Smith <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
Subject: Download Script Name
Hello all,
I have a script that successfully provides a user with an open/save confirmation dialog box when downloading a file, and the correct filename displays in the file name edit box (thanks to Content-Disposition). But when the file actually starts to download, the title bar of the IE download box says something to the effect of, "10% of blah.php Completed" and so on, instead of saying, "10% of ActualFileName.exe Completed." (By the way, this is IE6.0 under XP Pro). I understand that's technically correct, especially since blah.php is the file that opened and is actually printing the contents of ActualFileName.exe, but this is confusing for users who think they are downloading the blah.php file instead (even though the file name edit box displayed the correct file name).
My current work-around is to have ActualFileName.exe be a PHP script that opens ActualFileName.exe (the REAL ActualFileName.exe) and prints it out. And I only have Apache using PHP to process .EXE files in that one directory. But I'm curious as to whether there's a better way to do this, or whether I'm stuck on a technicality?
Thanks.
--
To insure that you receive proper support, please include all
past correspondence (where applicable), and any relevant
information pertinent to your situation when submitting a
problem report to the GW Micro Technical Support Team.
Aaron Smith
GW Micro
Phone: 260/489-3671
Fax: 260/489-2608
WWW: http://www.gwmicro.com
FTP: ftp://ftp.gwmicro.com
Technical Support & Web Development
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php