I'm not a ColdFusion expert, but am supporting what few ColdFusion pages we have left after our previous developer left. I'm trying to figure out how to get a text file downloaded with a click instead of right-click and selecing "save Target as". Here's the code I have:

<p> - - &gt; <a href="<cfoutput>?ccicsdds=report_download.download&file=#attributes.file#.TXT</cfoutput>">Report Download</a> &lt; - - </p>

I've been reading some web pages on using one or both of these:

<CFHEADER name="Content-Disposition" value="attachment;filename=#TheFile#">
<CFCONTENT file="#FULLPathX#" type="application/x-download" deletefile="no">

But it does not make sense to me. The reason we are doing this is because all of a sudden when someone right-clicks to save, the file name is saved as the name of the page, i.e. download.htm or download.txt depending on which browser they are using. We have a specific file name we want to save as which is defined in #attribute.file#.TXT .

If you have a better suggestion on how to force it to always save as the right file name, that would be great!

Thanks,
Rick

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.