Skip to main content
Inspiring
March 10, 2009
Answered

Download error in Safari

  • March 10, 2009
  • 1 reply
  • 1773 views
The thing is I have to create an excel sheet and make the file avaiable for clients as download. The code for that is --

The code is working perfectly in firefox, ie and chrome. But in safari the file is downloaded with the name of the page in which i have written the code and not the file name that i have specified. Is there anything I am missing? Please HELP!!!
    This topic has been closed for replies.
    Correct answer balumohan
    its windows..
    Hi..
    I got a solution. I gave like
    <!---now open file--->
    <cfset fullpath = #ExpandPath("individualExcelReport")#&"\"&"trialexport.xls">
    <cfheader name="content-disposition" value="attachment;filename=""trialexport.xls""">
    <cfheader name="Content-Description" value="This is a tab-delimited file.">


    <cfcontent type="application/msexcel; charset=utf-8" reset="true" file="#fullpath#" deletefile="true">

    That is in cfheader, I put a double quotes for the filename-- filename=""trialexport.xls""

    1 reply

    Inspiring
    March 10, 2009
    you got some weird <cfheader> tags there...
    they should be something like this instead:

    <cfheader name="Content-Type" value="[mime type of your file here]">
    <cfheader name="Content-Disposition" value="attachment;
    filename=[filename you want here]">
    <cfcontent type="[mime type of your file here]" file="[full absolute
    path to file here]" deletefile="Yes">

    btw, mime type of .xls files is "application/vnd.ms-excel", not
    "application/msexcel"
    (good mime types reference:
    http://www.w3schools.com/media/media_mimeref.asp)

    btw2, you probably do not event need to write the file to disc before
    serving it up. you could use <cfsavecontent> tag to save the generated
    content and then just stream it from server memory...


    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    balumohanAuthor
    Inspiring
    March 10, 2009
    Hi. Thank you for replying. But I am stuck up with the same issue. I tried with the mime type you specified. But its not still working in safari.