note 58001 added to function.header
| From: | wraezor at gmail dot com | Date: | Fri, 21 Oct 2005 03:08:10 +0000 |
| Subject: | note 58001 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97337@lists.php.net to get a copy of this message | ||
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.)
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58001
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58001&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58001&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58001&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58001&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58001&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58001&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58001&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58001&report=yes
Search -- http://master.php.net/manage/user-notes.php