27 Mar

Firefox Icon Logo

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!

Tagged: < excel | firefox | spaces | tips >
Posted in: < Website Server >
me@grafxflow avatar


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!

Visitors also viewed these posts

Add comment

Add comment