Skip to main content
Known Participant
June 29, 2006
Answered

IE and linking to CFCONTENT

I am having an issue with cfcontent and cfheader when generating an excel file. I have one page excel_content.cfm and another that links to it. in Firefox it works as I want, it gives the save dialog when clicking it, but in IE it opens it because its a recognized MIME type.

I found this page when looking to remedy it:
http://support.microsoft.com/kb/q260519/

But when I changed the name attribute of cfheader to attachment, it allowed the user to download a .cfm file that output the expected content of the excel file, but as an HTML table.

I am certain this isn't an uncommon feature. Has anyone found a method that works well?
    This topic is closed to new replies. Start a new post to keep the conversation going.
    BKBK
    BKBKCorrect answer
    Community Expert
    June 30, 2006
    The following code should instruct even IE to enable you download myDataFile.xls as yourData.xls

    <cfheader name="Content-Disposition" value="attachment;filename=yourData.xls">
    <cfcontent type="application/vnd.msexcel" file="c:\temp\XL\myDataFile.xls">

    4 replies

    BKBK
    Community Expert
    Community Expert
    July 1, 2006
    !
    Translate
    BKBK
    Community Expert
    BKBKCommunity ExpertCorrect answer
    Community Expert
    June 30, 2006
    The following code should instruct even IE to enable you download myDataFile.xls as yourData.xls

    <cfheader name="Content-Disposition" value="attachment;filename=yourData.xls">
    <cfcontent type="application/vnd.msexcel" file="c:\temp\XL\myDataFile.xls">

    Translate
    FreffieAuthor
    Known Participant
    June 30, 2006
    Thank you kindly. The key was to having both "Content-Disposition" and "attachment" present in the cfheader tag.
    Translate
    FreffieAuthor
    Known Participant
    June 30, 2006
    Is this possible?
    Translate