cfcontent and download

I havent used cfcontent in years and forgot that if you don't want the name of the file to be a .cfm then use cfheader to push the desired file name e.g. so your create .csv Coldfusion page would look something like

<cfset fPath = expandPath('_view/') & "newFileName.csv" />

<cffile action="write" file="#fPath#" output="#csvData#" />
<cfheader name="Content-Disposition" value="filename=newFileName.csv" />
<cfcontent file="#fPath#" deletefile="true" type="application/csv" />

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Mark Bryden's Gravatar WOW cheers bruv!

My life has been awlful this morning now after implimenting this code my csv fil now downloads a treat

CHEERS Andy
# Posted By Mark Bryden | 8/12/08 7:43 AM
BlogCFC was created by Raymond Camden / Contact Blog Owner / mptooling.com / spicemerchants-portsmouth.co.uk / ipicture.it