Submitted by Damien on
Tags:
Here's a quick tip that'll help make life easier for anyone who's trying to use ColdFusion's CFCONTENT tag to send content to the browser. When you're sending a file to the web browser using CFCONTENT you can do it either as an inline file, i.e. the browser will probably try to display it, or you can send it as a file to be downloaded. The only problem is that to do the latter you can't do it with just the CFCONTENT tag, you first need to tell the browser that you're sending a file and then send it, for example:
[source:html]
To pop open the magic Save As dialog in the browser you need to send the Content-disposition
HTTP header and tell it you're sending an attached file, along with the filename. Easy when you know how.