|
Posted by Philip Ronan on 10/13/05 18:19
"C16" wrote:
> $fp = fopen($filename, "rb");
> if ( $fp )
> {
> $filesize = $file['size'];
>
> header("Cache-Control: post-check=0, pre-check=0");
> header("Expires: 0");
> header("Content-Type: " . $xtype);
> header("Content-Length: " . (string)($filesize));
> header("Content-Transfer-Encoding: binary");
>
> while ( !feof($fp) )
> {
> echo(fgets($fp, 4096));
> }
> fclose($fp);
> }
Assuming $xtype is defined correctly somewhere, I reckon IE is choking on
the Content-Transfer-Encoding header. This is a MIME header -- it doesn't
belong in an HTTP response at all. Go and read RFC 2616 some time.
You don't need to cast $filesize to a string -- PHP will do this for you
anyway. And while you're at it, I suggest you replace the while() loop with
a readfile() statement instead (<http://uk.php.net/readfile>).
Oh, by the way, filesize() is another useful function. That way you can get
rid of the fopen and fclose instructions altogether.
Phil
--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
[Back to original message]
|