CFContent/CFHeader file download attachment error when using SSL

Posted on 2005-05-02
Last Modified: 2013-12-24

I have the following two lines of code:

<cfheader name="Content-Disposition" value="attachment;filename=#filePre##fromDate#-#toDate#.csv">

<cfcontent type="application/octet-stream" deleteFile="Yes" file="#pathName#\admin\wa_ie\#filePre##fromDate#-#toDate#.csv">      

To push a .csv file to the end user. It works in IE 6.0.2900 under HTTP, and works with Firework under both HTTP & HTTPS. It does NOT work under IE & HTTPS. I've found several references to this being a general problem with IE, but of course, no solutions from MS on the issue.

Is there a way to work around this in CFMX?
Question by:jaxman
    LVL 22

    Expert Comment

    well My company could not do this also.
    Finally we put the msg that "right click to download the file". I do not think even this issue is solved in CF 7. I have not tried thought yet.
    It will be interesting to know if anyone know the answer of this.
    LVL 35

    Expert Comment

    IE has several bugs when you introduce HTTPS - such as synamically adding rows to tables did not work on IE on a Mac if you used HTTPS - it worked with HTTP.

    For some reason I think there are distinct differences in how IE handles various features with HTTPS vs standard HTTP

    Author Comment

    After hours of searching on google, I discovered the issue:

    If you have Pragma: no-cache or Cache-Control: no-cache set, IIS has a known bug that prevents attachment downloads from happening under HTTPS.

    Known bug URL:

    So, you need to check your HTTPS headers and make sure neither of those are defined. If they are being defined by IIS outside of your application, there is a command line utility you can run;en-us;247404

    to set the value in IIS if they are defaulting to the wrong values.
    LVL 22

    Expert Comment

    Another reason is that when you use https browser does not let modify the headers and coldfusion needs to modify the headers to display the inline file. So it is not possible.
    LVL 35

    Expert Comment

    SO as you have seen the answer to:

    "Is there a way to work around this in CFMX?"

    Is no.
    LVL 1

    Accepted Solution

    What is the part that is not working?  IE in HTTPS does not download the file at all, or does it open into the browser like what I've been trying to avoid?

    My site runs on HTTPS and has a file that specifically serves other files from non-exposed directoreis, but once I manipulated the headers enough I didn't have any problems having it prompt for download.  My main problem was IE adding a [1] to the filename, but through headers I was also able to work around that.

    All of the headers I'm using below were important to get this working correctly:

    <cfdirectory action="LIST"
    <cfif getfile.size eq "">
          <cflocation url="home.cfm?filenotfound=true" addtoken="false">
    <cfheader name="Content-Length" value="#getfile.size#">
    <cfheader name="Content-Type" value="application/octet-stream">
    <cfheader name="Content-Disposition" value="attachment;filename=#url.file#">
    <cfheader name="Content-Location" value="#URLEncodedFormat(url.file)#">

    <cfcontent type="application/octet-stream" file="#session.securefiles#\#url.file#">

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
    Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now