[ciapug] header problem
David Champion
dave at dchamp.net
Thu Apr 2 09:45:37 CDT 2009
Does this happen in all browsers, or just IE?
For downloading PDF and other docs, you can do something like this:
$file = fopen("report.pdf",rb);
header("Content-Type: application/pdf");
header(...
readfile($fh);
There are some other headers that you should also send (Pragma, Expires,
Cache-Control...). Do some googlin' and you should find lots of examples.
-dc
Dave J. Hala Jr. wrote:
> I've got a php 5.x script that creates a report. It works like this:
> 1) query the database based on user input
> 2) format the resultset as html
> 3) use the html to create a pdf file on hard drive
> 4) use the php header("location: report.pdf") function to open the pdf
> in the users browser.
>
> It worked well for a long time. It just stopped working. The interesting
> thing is it runs fine on the secure intranet, but not on the outside
> secure site. I double checked and there aren't any log errors and the
> the file is actually being created on the harddrive. It isn't a firewall
> issue. It would appear that the process breaks at header function.
>
> The same functions work properly on the both the inside and outside for
> a number of other reports that take less time. Its almost like there is
> timeout happening somewhere, but I'm not seeing any, nor can I find any
> error messages. To the end user, it just appears to hang.
>
> Has anyone seen anything like this before?
>
>
> :) Dave
>
>
>
More information about the ciapug
mailing list