note 61272 deleted from function.header by sp
| From: | sp@php.net | Date: | Sun, 05 Feb 2006 13:13:30 +0000 |
| Subject: | note 61272 deleted from function.header by sp | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-103031@lists.php.net to get a copy of this message | ||
Note Submitter: SteveS
----
I too was also having a problem getting my files to be displayed properly in IE, mainly on a PC
though.
In Firefox on OS X 10.4.4 it was working fine, and clicking on the link brought up a dialog box
asking whterh I wanted to open or save the file.
In Safari 2.0.3 it automatically displayed within Preview embedded in the browser window.
On a PC however, it couldn't determine the type of file nor open it properly and would always
insist on downloading it first.
Anyway, heres the headers I sent that made it work properly (display within Acrobat within the
browser).
if (is_readable($fileloc)){
header("Pragma: public");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: must-revalidate");
header("Content-type: application/pdf");
header("Content-Length: ".filesize($file));
header("Content-disposition: inline; filename=$filename");
header("Accept-Ranges: ".filesize($file));
readfile($file);
exit;
}
Many thanks to the note below for some(most!) of the code! Cheers.