Re: Correct headers for I.E. to open PDF?
| From: | Curt Zirzow | Date: | Sat, 04 Sep 2004 03:04:32 +0000 |
| Subject: | Re: Correct headers for I.E. to open PDF? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-195799@lists.php.net to get a copy of this message | ||
* Thus wrote Paul Danko:
>
> What should the headers be for a client to download a PDF document and
> have it open using adobe i.e. pluggin??
>
> Here is code I am using, it works on some versions of I.E., but not all:
>
>
> $pdfdoc = $__BASE_PDF_BUILD_DIRECTORY.$_GET['FID'];
>
> $filesize = filesize($pdfdoc);
> header("Pragma: ");
> header("Expires: 0");
> header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
> header("Content-type: application/pdf");
This can be difiult to control sometimes. You could send a header
like so:
header("Content-Type: application/octet-stream");
Will generally do the trick. There are times when i've seen IE
behave in very wierd, no matter the content-type, for example,
accessing a url like:
http://domain.com/a/file.php?param=1&bar=.jpg
IE may attempt to display the thing in the browser because it saw
the .jpg extension, even though I sent a headers that should
have prompted a download.
IE has gotten better but it still all depends on how the person has
their computer set up to handle content types (IE tries to be too
smart sometimes.)
Curt
--
The above comments may offend you. flame at will.