AdobeStock_455007340

Generating Paged To Be Saved

Generating a file that you want users to save (and not display)? Use to set the MIME type to “unknown”, this will force the browser to display the “Save As” box. (Applies to: ColdFusion All)

One response to “Generating Paged To Be Saved”

  1. Yosu Armendia Avatar
    Yosu Armendia

    I am using cfcontent type="application/unknown" to download a .txt file and get a Save As dialog box. This worked fine with 2000, but no longer works with XP, Service Pack 2.
    So I changed the type to text/plain, or text/comma. The problem is that when I display the text file on the screen, and do Save As in Internet Explorer, the file type defaults automatically to HTML, and the filename that I gave the file is ignored. Here is the code:
    <cfheader name="Content-Disposition" value="filename=QBERslt.txt" >
    <cfcontent reset="Yes" type="text/plain" file="#application.AsciiFile#"
    deletefile="No">
    Does anyone have any suggestions as to why this might be happening?

Leave a Reply