|
Posted by C16 on 10/13/05 17:55
Hi All
I have a simple download script for files on my website and I use the code
below to download the files:
$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);
}
Now this works just fine on Firefox and Opera, and even on IE when its used
in a web page ie <img src="download.php?id=2"/> but if I try and go to a
file directly by typing in the url www.website.com/download.php?id=2 then it
opens a Download dialog asking me to save the file instead of displaying it
in the browser, this only happens with IE though. Am I missing a vital bit
to the header, or is this a problem with IE, if so is there a way around it
at all?
Many thanks.
Navigation:
[Reply to this message]
|