I'm using this code to download a file:
I have to use this so that .html files can be downloaded and not simply viewed. I've noticed thought that in IE there is no extension to the file. in FireFox it gives the corrrect file xtension, but not in IE. I've even tried reading the user agent and manually entering an extension for IE. Still didn't work.PHP Code:<?
//Download a file
$file = $_GET['file'];
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: application/x-zip");
header("Content-disposition: attachment; filename=".$file);
readfile($file);
?>
Actually, the file even has different names in the two browsers, neither of which are the name of the real file, they still download correctly though.
Can someone please tell me why IE doesn't give an extension and how to give it one.





Reply With Quote