Firefox Icon Logo

Written by me@grafxflow

27 Mar, 2011



Firefox issue with spaces in excel download file name

Recently I was working on an php class to save down an excel file from a database. And the client got back to me saying the filename was the wrong format and had no extension. So I asked them to send me the file.

And it turned out there is an issue with the Firefox browser not allowing spaces in download file names when using the php header. So 'Example download file.xls' became 'Example'. This happened with all files even Acrobat pdfs.

I did some research and found a way of making it work. Which meant changing the following

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


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

Enjoy the problem is solved!

Add comment

Smart Search

132 Following


Hull, United Kingdom

I am a Full-stack Developer who also started delving into the world of UX/UI Design a few years back. I blog and tweet to hopefully share a little bit of knowledge that can help others around the web. Thanks for stopping by!