All IE has a bug for download file so.:) see this http://support.microsoft.com/default.aspx?scid=kb;en-us;308090 some unkown mime type also display in IE no popup a download window 2009/8/26 Ryan Cavicchioni <ryan@xxxxxxxxxxxxxxxx>: > On Wed, Aug 26, 2009 at 03:38:27PM +0200, Grega Leskov??ek wrote: >> I tried to download the file from another server the fancy way in PHP, but >> it just display blank screen. Can You please look at my code: > > If it helps, here is some code that I dug up from an old project: > > <?php > > $filepath = "/var/www/test.doc"; > $filename = basename($filepath); > $filesize = filesize($filepath); > > if ( file_exists($filepath) ) > { > header("Cache-Control: no-store, must-revalidate"); > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); > header("Content-Transfer-Encoding: binary"); > header("Content-Type: application/force-download"); > header("Content-Type: application/octet-stream"); > header("Content-Type: application/download"); > header("Content-disposition: attachment; filename=" . $filename); > header("Content-length: " . $filesize); > $fh = fopen($filepath, "rb") or exit("Could not open file."); > while (!feof($fh)) > { > print(fgets($fh,4096)); > } > fclose($fh); > } else { > echo "The file does not exist."; > } > > ?> > > I would also verify that the web server has permissions to the files > that php is trying to open. Internet Explorer 8 seems to have a > problem with the filename parameter in the Content-disposition header > being enclosed in quotes. It would just dump the binary data in the > page when I was testing this. > > Regards, > Ryan > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php