Please answer this simple SPAM challenge: nine minus eight?
(Example: nine)

The Note You're Voting On

bebertjean at yahoo dot fr
9 years ago
If using the 'header' function for the downloading of files, especially if you're passing the filename as a variable, remember to surround the filename with double quotes, otherwise you'll have problems in Firefox as soon as there's a space in the filename.

So instead of typing:

("Content-Disposition: attachment; filename=" . basename($filename));

you should type:

("Content-Disposition: attachment; filename=\"" . basename($filename) . "\"");

If you don't do this then when the user clicks on the link for a file named "Example file with spaces.txt", then Firefox's Save As dialog box will give it the name "Example", and it will have no extension.

See the page called "Filenames_with_spaces_are_truncated_upon_download" at for more information. (Sorry, the site won't let me post such a long link...)

<< Back to user notes page

To Top