I am working on a script to force downloading a file. The script works fine
with NS (4.8 and 7) but does not work correctly with IE 6.0
I have looked at examples on php.net and have googled for a solution, but
still can't find a solution. I think IE wants to download the script instead
of the file.
Here's what the code I'm working on looks like:
<?php
$sender=$_GET["sender"];
$filename=$_GET["filename"];
//Data validation goes here
$filePath="../users/".$sender."/".$filename;
if(file_exists($filePath))
{
Header("Content-Length: ".filesize($filePath));
Header("Content-type: application/download");
Header("Content-Disposition-type: attachment");
Header("Content-Disposition: filename=\"".$filename."\"\n");
Header("Content-Transfer-Encoding: binary");
$fp = fopen($filePath,"rb");
fpassthru($fp);
}
?>
The funny thing is that I have a similar script that I use to download an
sql file and it works correctly.
Luis R. Lebron
Sigmatech, Inc