Skip to main content
June 24, 2009
Question

filename in CFHeader

  • June 24, 2009
  • 2 replies
  • 1087 views

I'm using the following to export a CSV file:

<cfheader name="Content-Disposition" value="attachment;filename=download.csv">
<cfcontent type="text/csv" reset="yes"><cfoutput>#variables.output#</cfoutput>

This works fine in IE, but in FF the filename comes out as "download.csv," with a trailing comma, and in Chrome as "download.csv, attachment".  Because of this Excel doesn't recognize it.  Why is the filename not coming out as instructed?  I believe this has worked fine in the past, but not in this particular case.

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
June 28, 2009

Try using Excel's type instead, namely

<cfcontent type="application/vnd.ms-excel">

What happens?

Participating Frequently
June 25, 2009

I haven't tested in Chrome but in Firefox, IE and Safari it works as

expected (filename is download.csv).

Mack