[thelist] Serving PDFs

Noah St. Amand noah at tookish.net
Sun Feb 25 14:41:22 CST 2007


Hi Chris,

Chris Price wrote (2/22/07 5:59 PM):
> Noah St. Amand wrote:
>> This might be a bad practice, but I've had good luck with just the
>> following:
>>
>> header('Content-type: application/pdf');
>> header('Content-Disposition: attachment; filename="file.pdf"');
>> readfile('/path/to/file.pdf');
>>
>> I don't think I'm sending the length of the file anywhere. This might be 
>> worth a shot.
>>   
> Was this a hunch or can you explain the method.

When I had to do the same thing, I just used the PHP man pages and put 
in as little code as I could in order to make it work.

Sorry, I guess that's not very insightful. I'm glad it's working for 
you, though.

Cheers,
Noah



More information about the thelist mailing list