[thelist] HTTP headers for PDF files and IE
Johan Martin
jnm at catenare.com
Sat Oct 14 20:45:23 CDT 2006
On 13 Oct 2006, at 4:53 PM, Bill Moseley wrote:
> I'm missing something obvious here about downloading a PDF file.
>
> For a dynamically generated PDF I set these headers:
>
> Content-Type: application/pdf
> Content-Disposition: attachment; filename=pdf1.pdf
>
> This works fine in Safari, Opera, FF, lynx, w3m but not in IE.
>
> IE reports:
>
> The requested site is either unavailable or cannot be found.
>
> Here's the full headers:
>
> $ HEAD http://infopeople.org/pdf1
> 200 OK
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
> pre-check=0
> Connection: close
> Date: Fri, 13 Oct 2006 23:00:21 GMT
> Pragma: no-cache
> Via: 1.1 infopeople.org
> Server: Apache/2.0.54 (Debian GNU/Linux) mod_perl/2.0.2 Perl/v5.8.4
> Content-Length: 100504
> Content-Type: application/pdf
> Client-Date: Fri, 13 Oct 2006 23:00:21 GMT
> Client-Peer: 208.97.158.169:80
> Client-Response-Num: 1
> Content-Disposition: attachment; filename=pdf1.pdf
> Set-Cookie: ws2_session=d85a081082fb023f3faae02f427f9a01777f415d;
> domain=.infopeople.org; path=/
>
This is what I've used successfully with IE. Hope it helps.
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: private");
header("Content-type: ".$file_detail['file_type'] );
header("Content-disposition: attachment; filename=".$file_name);
header("Content-length: ".$len);
Johan Martin
Catenare LLC
534 Pacific Ave
San Francisco, CA. 94133
Phone: (415) 834-9802
Fax: (415) 294-4495
http://www.catenare.com
Johan N. Martin
Catenare Information Technology cc
15 Hinsbeeck Str
Florida Park, 1709
Cnr. St. Francis & St. Christopher
Klipspruit West, Ext. 2 1811
Mailing Address:
PO Box 2385
Florida Hills, 1716
Phone: +27 11 947-1027
Fax: +27 11 947-1026
Cell: +27(76) 599-3508
More information about the thelist
mailing list