[H-GEN] Pdf-php puzzle - solution
Paul Clarke
paul at sitedynamics.com.au
Mon Sep 27 17:07:24 EDT 2004
Thanks Damien,
The solution was to include the line:
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
This was mentioned in the http://au2.php.net/header#45773 page along
with another header, header("Pragma: public"); which did not affect the
outcome but I will include in case it is needed for the next version of
IE and do some more research.
The application/.pdf was not the cause of any problems, I was also
trying to code the creation of that line based on the file extension but
I think I will need to address an array of known types.
Thanks heaps
Paul
-----Original Message-----
From: general-bounces at lists.humbug.org.au
[mailto:general-bounces at lists.humbug.org.au] On Behalf Of Damien Ayers
Sent: Tuesday, 28 September 2004 2:18 AM
To: general at lists.humbug.org.au
Subject: Re: [H-GEN] Pdf-php puzzle
[ Humbug *General* list - semi-serious discussions about Humbug and
]
[ Unix-related topics. Posts from non-subscribed addresses will vanish.
]
On Mon, 2004-09-27 at 21:16 +1000, Paul Clarke wrote:
> My site http://www.qfom.com.au/membership/ has the DocumentRoot line
> of the Apache conf file pointing to a php file, this works very well
> (as you would expect), however, I am using the following lines of php
> code to output the file if it is a pdf file:
>
> header("Content-type: application/pdf");
> header("Content-Disposition: attachment; filename=".$file);
> readfile($path.$file);
My first guess is that not sending a Content-Length header is confusing
either IE or your PDF viewer. Google turned up a note in the php manual
from someone who seems to have had the same problem:
http://au2.php.net/header#45773
He's included a few extra headers along with Content-Length, that may or
may not be required, but probably won't do any harm.
I also noticed that the Content-type being returned for a pdf file from
your site is 'application/.pdf', which is also an issue, but I'm
assuming this isn't the main problem, since you have the correct type in
the code in your email.
> Now this may come as a total surprise to you but it works perfectly in
> firefox but IE produces an error "There was an error opening this
> document. The file does not exist."
I don't have IE anywhere to test with, but best of luck getting this
working.
Cheers, Damien
_______________________________________________
General mailing list
General at lists.humbug.org.au
http://lists.humbug.org.au/cgi-bin/mailman/listinfo/general
More information about the General
mailing list