dans.blog


The miscellaneous ramblings and thoughts of Dan G. Switzer, II

Problems with CFCONTENT and Firefox downloading filenames with spaces...

If you use <cfcontent> and <cfheader> tags to push files to the browser, then you may have come across this problem. You're pushing a file that contains spaces in the name. In Internet Explorer, the file gets downloaded with the correct filename, but in Firefox the filename only contains the first word in the filename.

I've ran into this problem a little while ago and instead of spending a bunch of time trying to figure it out, I just replaced the spaces with underscores. However, today Jeff Smallwood posted that he was having the same problem on a mailing list. Charlie Arehart suggested using quotes to surround the filename in the value attribute of the <cfheader> tag. After some testing, Jeff found that this does in fact fix the problem. Here's an example:

<cfheader
	name="Content-Disposition"
	value="attachment; filename=""this file has spaces.txt"""
	/>

more…