Bug #13601 Updated: File download with Content-Length specified fails with IE5.5
| From: | adam at net-europa dot com | Date: | Mon, 08 Oct 2001 17:55:47 +0000 |
| Subject: | Bug #13601 Updated: File download with Content-Length specified fails with IE5.5 | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-67562@lists.php.net to get a copy of this message | ||
ID: 13601
User updated by: adam@net-europa.com
Reported By: adam@net-europa.com
Status: Open
Bug Type: Apache related
Operating System: Linux (Red Hat 7)
PHP Version: 4.0.6
New Comment:
The following code:
$size = filesize($userfile);
$fp=fopen($userfile,"r");
header("Pragma: no-cache");// HTTP/1.0
header("Cache-Control: no-cache, must-revalidate");// HTTP/1.1
header("Content-Type: application/octet-stream");
if(preg_match("/MSIE 5.5/", $HTTP_USER_AGENT))
header("Content-Disposition: filename=$userfile");
else
header("Content-Disposition: attachment; filename=$userfile");
header("Content-Length: $size");
header("Content-Transfer-Encoding: binary\n");
fpassthru($fp);
when run under Linux/Apache results in a zero length file on MS IE 5.5 when connecting via an ISP or
proxy. I have tried various ISPs all with the same result. All is fine with Netscape, or with a
direct LAN connection.
Also, if the same PHP script is run under Windows NT 4.0 / IIS 5.0 all is well.
By removing the line: header("Content-Length: $size"); the download is successful, but we
lose any progress bar so this workaround is far from ideal.
Previous Comments:
------------------------------------------------------------------------
[2001-10-08 13:52:25] adam@net-europa.com
The following code:
$size = filesize($file);
header("Pragma: no-cache");// HTTP/1.0
header("Cache-Control: no-cache, must-revalidate");// HTTP/1.1
header("Content-Type: application/octet-stream");
if(preg_match("/MSIE 5.5/", $HTTP_USER_AGENT))
header("Content-Disposition: filename=$userfile");
else
header("Content-Disposition: attachment; filename=$userfile");
header("Content-Length: $size");
header("Content-Transfer-Encoding: binary\n");
fpassthru($fp);
when run under Linux/Apache results in a zero length file on MS IE 5.5 when connecting via an ISP or
proxy. I have tried various ISPs all with the same result. All is fine with Netscape, or with a
direct LAN connection.
Also, if the same PHP script is run under Windows NT 4.0 / IIS 5.0 all is well.
By removing the line: header("Content-Length: $size"); the download is successful, but we
lose any progress bar so this workaround is far from ideal.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13601&edit=1