title: Coldfusion - allow user to choose where to save generated csv file
body: <p>Thanks to your tips and Ben Nadel's QueryToCSV solution, I'm now able to generate CSV files from my queries. However, I'd like to allow the user to choose where to save the generated file. The documentation states that:</p>
  
  <blockquote>
    <p>The following tag can force most browsers to display a dialog box that asks users
        whether they want to save the contents of the file specified by the cfcontent tag 
        using the filename specified by the filename value. If the user selects to open 
        the file, most browsers open the file in the related application, not the browser
        window.</p>
  
  <pre><code>&lt;cfheader name="Content-Disposition" value="attachment; filename=filename.ext"&gt;
  </code></pre>
  </blockquote>
  
  <p>This works for PDF files, but I can't make it work with CSV files. Currently I'm writing the file to a temp file first, then calling cfcontent, then cfheader:</p>
  
  <pre><code>&lt;cffile
    action="WRITE"
    file="#filename#"
    output="#CSVString#"
  /&gt;
  
  &lt;cfcontent file="#filename#" type="text/plain" &gt;
  &lt;cfheader name="Content-Disposition" value="attachment; filename=#filename#"&gt;
  </code></pre>
  
  <p>This works to write the file to the temp directory, then to the browser window; but I can't figure out how to allow the user to choose where to save.</p>