Download file
| From: | Radovan Radic | Date: | Mon, 25 Nov 2002 10:58:04 +0000 |
| Subject: | Download file | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-17108@lists.php.net to get a copy of this message | ||
Hi
I have problems with downloading files from my web application in php.
Here is the code from download.php
<?
if (isset($dload))
{
if ($dload=="cdrs") //
{
$filename="./dload_files/temp.txt";
// now create file, and load some data from mssql in it - it is ok
$fp=fopen($filename,"w");
write_data($fp);
fclose($fp);
}
$len=filesize($filename);
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header("Content-type: application/download");
header("Content-Length: $len");
header("Content-Disposition: attachment; filename=\"$filename\"");
$fp=fopen($filename, "r");
fpassthru($fp);
exit;
}
?>
download.php is called from another page
I get the save as dialog box , but filename is not temp.txt but download
with no extension. I have heard this is bug in IE about content-disposition
headers.
Anyone can help here?
Radovan