Wednesday, 18 September 2013

PHP Download file with header

PHP Download file with header

I know it's something easy, but I can't seem to find the solution. I want
to download a pdf from a folder. The pdf is in a folder named forms. My
script is in a different folder.
When I try to download the file with the following code:
header('Content-Disposition: attachment; filename="forms/form1976.pdf"');
The filename becomes: forms-form1976.pdf. That's not right, the filename
should be: form1976.pdf. How do I enter the the correct folder first?

No comments:

Post a Comment