Hi Bryan,

This is the code that I found on the list.

<!--- force download dialogue box to open --->
<cfoutput>
  <cfheader name="Content-type" value="application/octet-stream">
  <cfheader name="Content-Disposition" value='attachment; filename="#FileName#"'>
  <!--- if this fouls up in various browsers...try trailing slash in file attribute below --->
  <cfcontent file="#FullFilePath.Value#" type="application/octet-stream">   
</cfoutput>

The application/octetstream mime type will ALWAYS force the download dialgue window and the above code will always show the correct file name and extension to download

Like I said previously this code works some of the time.  Actually most of the time in Netscape.  Its IE that I am having issues with.

Mike
  ----- Original Message -----
  From: Bryan Stevenson
  To: CF-Talk
  Sent: Friday, April 16, 2004 1:47 PM
  Subject: Re: CFMX & cfcontent

  Mickael,

  My server is toast right now so I can't grab the code, but I do have code using CFCONTENT/CFHEADER that ALWAYS pops the download dialogue with the correct file name.

  Search the CF-Talk archives for my name ("Bryan Stevenson") and "CFCONTENT" and "octet" and you should find it.

  Cheers

  Bryan Stevenson B.Comm.
  VP & Director of E-Commerce Development
  Electric Edge Systems Group Inc.
  t. 250.920.8830
  e. [EMAIL PROTECTED]

  ---------------------------------------------------------
  Macromedia Associate Partner
  www.macromedia.com
  ---------------------------------------------------------
  Vancouver Island ColdFusion Users Group
  Founder & Director
  www.cfug-vancouverisland.com
    ----- Original Message -----
    From: Mickael
    To: CF-Talk
    Sent: Friday, April 16, 2004 10:42 AM
    Subject: Re: CFMX & cfcontent

    I know this is not CF but does anyone know of a _javascript_ or PHP script that I can pass a URL file name to download a file?  
      ----- Original Message -----
      From: Mickael
      To: CF-Talk
      Sent: Friday, April 16, 2004 12:12 PM
      Subject: Re: CFMX & cfcontent

      Tried both of those, no luck
        ----- Original Message -----
        From: Benjamin S. Rogers
        To: CF-Talk
        Sent: Friday, April 16, 2004 11:58 AM
        Subject: RE: CFMX & cfcontent

        Try "attachment" instead of "inline" in your cfheader tag.

        Ben Rogers
        http://www.c4.net
        v.508.240.0051
        f.508.240.0057

        ________________________________________
        From: Mickael [mailto:[EMAIL PROTECTED]
        Sent: Friday, April 16, 2004 11:34 AM
        To: CF-Talk
        Subject: Re: CFMX & cfcontent

        Hi Dave,

        Let's say my browser where I do not have the option to open XLS in my
        browser selected.  What happens is that I get the cfm template as the
        filename in the save as dialogue box.

        I noticed in your examples that you added foo to the Query string.  My query
        string contains the file name which is a date that I append to the a base
        filename.  My client has files that are called YYYYMMDDProcessing_Report yet
        they only want to see the filename in the save as box as
        processing_report.xls

        like so

        template.cfm?filedetails=#filedetails#

        Then my act page has the following

        <cfheader name="content-disposition"
        value="inline;filename=Processing_Report.xls">
        <cfcontent type="application/unknown"
        file="c:\inetpub\DailyDownload\#variables.file_details#Processing_Report.xls
        ">

        When the dialoge box comes up, what I get is the my cfm template with my url
        string.

        Any ideas

        Mike

          ----- Original Message -----
          From: Dave Watts
          To: CF-Talk
          Sent: Friday, April 16, 2004 11:09 AM
          Subject: RE: CFMX & cfcontent

          > I have never been able to get CFCONTENT to consistently force
          > a download of a file, let's say an excel file to the user.  I
          > have actually spent the whole morning looking for a PHP or
          > _javascript_ replacement for this.  
          >
          > I am on a Shared hosting environment but have found CFCONTENT
          > unreliable on CFMX.  Do you find it reliable?  If yes what is
          > your secret :)

          You can't force a download of a file - that's up to the user (and his or
        her
          browser). You might try running these samples on your server and see how
          they work for you:

          http://www.figleaf.com/demo/mimetest/

          Dave Watts, CTO, Fig Leaf Software
          http://www.figleaf.com/
          phone: 202-797-5496
          fax: 202-797-5444
        ________________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to