[from MozillaZine Knowledge Base]
Filenames with spaces are truncated upon download
When downloading certain files, you may find that the filename is truncated up to the first space. Thus, a link to download the file "My Report.doc" produces a save dialog containing "My" as the filename. This is a case of
download.php incorrectly sending the content-disposition filename, cut (truncated) at space, and the browser coping as best it can.
Fix
Change the code in
download.php at line 72 to this:
header("Content-Disposition: attachment; filename=\"".basename($filename)."\"");
Detailed Explanation
Using the earlier example of "My Report.doc", the webserver should send these HTTP headers to adhere to the specification and be compatible with all browsers:
Content-Type: application/msword
Content-Disposition: attachment; filename="My Report.doc"
Note that the filename is surrounded by double quotes, per
RFC 2231
. This allows for the use of extended characters within the filename (i.e., international characters, though at present Internet Explorer does not support this internationalization).
Not including the enclosing quotes around the filename creates an ambiguity when parsing the header for the filename when the browser has to consider the possibility of internationalized filenames. As Internet Explorer does not have to worry about this, it will parse the filename until the end of the line. Mozilla will not.
External Links