note 58001 deleted from function.header by tularis
| From: | tularis@php.net | Date: | Fri, 20 Apr 2007 14:43:57 +0000 |
| Subject: | note 58001 deleted from function.header by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125657@lists.php.net to get a copy of this message | ||
Note Submitter: wraezor at gmail dot com
----
Adding onto all the helpful material here, I have something to add, discovered by trial and error.
When initiating a file download with the following command:
header('Content-Disposition: attachment; filename="downloaded.pdf"');
Ensure that the 'filename' does not contain a directory path. It will work, but Internet
Explorer will not pick up the filename.
Example:
I had a script, called save.php which did just that, grabbing individual files in a subdirectory
("results/downloaded.pdf"). Since it was in a subdirectory, it could find the file, but
IE (Using 6sp1) wouldn't pick up the name when suggesting for the 'Save' option.
Firefox and Opera were fine.
So, moral of the story, the 'filename' should only ever contain a filename, no
directories. This is only really relevant when people couldn't be expected to know the
filename/extension, like in my case with FRF files. (Note: This was my experience at least.)