Re: displaying a pdf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2011-06-01 at 13:31 -0500, Tamara Temple wrote:

> On Jun 1, 2011, at 9:54 AM, Jim Giner wrote:
> 
> > Well - the code works just fine as is and that's all I care about.   
> > As for
> > Richard's comments - the url in my header(Location....) statement  
> > points to
> > a pdf file, not a php file, so the target is not sending any headers  
> > (that I
> > know of ).
> 
> The server will send the appropriate headers for files like that. If  
> you want to see it, try doing a wget or curl and make sure to snag the  
> headers as well (or instead) of the actual file.
> 
> For instance:
> 
>    curl -O -D headers.txt 'http://wiki.tamaratemple.com/uploads/Main/CoolWebThings/bumping_locks.pdf'
> 
> returns headers.txt:
> 
> HTTP/1.1 200 OK
> Date: Wed, 01 Jun 2011 18:28:28 GMT
> Server: Apache/2.2.3 (CentOS)
> Last-Modified: Mon, 03 Dec 2007 02:54:08 GMT
> ETag: "9386f8-323dc0-e4df9400"
> Accept-Ranges: bytes
> Content-Length: 3292608
> Content-Type: application/pdf
> 
> without doing anything special.
> 
> (no, i don't advocate going around picking locks. it's just useful  
> info to have...)
> 


The advantage to having PHP send the correct headers, is that the file
you are linking to does not need to be in a web accessible area, meaning
that it's protected from someone accessing it without passing some form
of security you have in place in your PHP code. Also, it removes any
issues with a server not having been set up correctly, which is quite
often a problem on IIS (Apache is a lot better, but even it has issues
with some less-popular formats)

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux