note 114450 added to function.readfile
| From: | riksoft at gmail dot com | Date: | Fri, 21 Feb 2014 18:03:54 +0000 |
| Subject: | note 114450 added to function.readfile | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198586@lists.php.net to get a copy of this message | ||
Just a note for those who face problems on names containing spaces (e.g. "test test.pdf").
In the examples (99% of the time) you can find
header('Content-Disposition: attachment; filename='.basename($file));
but the correct way to set the filename is quoting it (double quote):
header('Content-Disposition: attachment;
filename="'.basename($file).'"' );
Some browsers may work without quotation, but for sure not Firefox and as Mozilla explains, the
quotation of the filename in the content-disposition is according to the RFC
http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.readfile.php
Edit -- https://master.php.net/note/edit/114450
Del: integrated -- https://master.php.net/note/delete/114450/integrated
Del: useless -- https://master.php.net/note/delete/114450/useless
Del: bad code -- https://master.php.net/note/delete/114450/bad+code
Del: spam -- https://master.php.net/note/delete/114450/spam
Del: non-english -- https://master.php.net/note/delete/114450/non-english
Del: in docs -- https://master.php.net/note/delete/114450/in+docs
Del: other reasons-- https://master.php.net/note/delete/114450
Reject -- https://master.php.net/note/reject/114450
Search -- https://master.php.net/manage/user-notes.php