Force IE file download with PHP
March 18th, 2007 by Oliver - Tagged with - Posted in Other Stuff
I have found a fair few articles on how to force a file download promt with PHP for a recognised MIME type. After spending hours trying different methods I found the following that works for me on IE6+.
header(‘Content-type: application/octetstream’);
header(‘Content-Disposition: attachment; filename=”myfile.pdf”‘);
readfile(“/local/path/to/file/”);
exit();
header(‘Content-Disposition: attachment; filename=”myfile.pdf”‘);
readfile(“/local/path/to/file/”);
exit();







