[ciapug] header problem
Dave J. Hala Jr.
dave at 58ghz.net
Thu Apr 2 11:11:34 CDT 2009
The Live headers is a nice tool. I just used it to confirm that there
isn't anthing wrong with the headers. (as far as I know)
I'm going to ahead and give the readfile thing a try.
On Thu, 2009-04-02 at 10:24 -0500, Matthew Nuzum wrote:
> On Thu, Apr 2, 2009 at 10:03 AM, David Champion <dave at dchamp.net> wrote:
> > It has other advantages... for instance you can use readfile() to access
> > documents that are stored outside of the web files, if you want to
> > control access to files.
> >
> > Could it be an issue with header() not sending the correct URL for the
> > .pdf when you access the extranet? Can you use wget and see what the
> > output is? If you have something checking for login creds, you may have
> > to make a simple test page...
> >
>
> There's a firefox extension called "Live HTTP Headers" which can be a
> big help in these situations. You just open the window and it lets you
> inspect the http headers (in both directions).
>
> I too use the readfile method in these situations. I'd try it without
> the header() statement once. Naturally you're going to get a bunch of
> garbage to the window but if there's a PHP error at least you'll see
> what it is.
>
> Here is the PHP I use to generate the necessary http headers. There
> may be a better way now, I wrote this code years ago:
>
> header("Content-Type: application/octet-stream");
> header("Content-Length: $size");
> header("Content-Disposition: attachment; filename=\"$name\"");
> header("Content-Transfer-Encoding: binary");
>
> The benefit of your technique using the redirect is it lets the server
> deal with the headers. I don't think your way is wrong or bad. It
> should work.
>
> Maybe your filesystem is getting full or for some reason your script
> can't write the output file. Turning off the header will probably
> expose this.
>
--
___
Dave J. Hala Jr.
President OSIS, Inc.
www.osis.us
More information about the ciapug
mailing list