Reply to Php Download script problem!

Your name:

Reply:


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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация