I disagree. This is the syntax I use with the best success for all types of
files:

<cfheader name="Content-Disposition" value="attachment;
filename=#url.file#">
<cfif isdefined("url.nonsecure")>
        <!--- map to gates webdocs directory --->
        <CFIF HTTP_USER_AGENT CONTAINS "MSIE">
                <CFCONTENT TYPE="#mimetype#" 
FILE="e:\webdocs\#url.thispath#\#url.file#">
        <CFELSE>
                <CFCONTENT TYPE="application/unknown"
FILE="e:\webdocs\#url.thispath#\#url.file#">
        </CFIF>
<cfelse>
        <!--- map to secure directory --->
        <CFIF HTTP_USER_AGENT CONTAINS "MSIE">
                <CFCONTENT TYPE="#mimetype#"
FILE="e:\secureDocs\#url.thispath#\#url.file#">
        <CFELSE>
                <CFCONTENT TYPE="application/unknown"
FILE="e:\secureDocs\#url.thispath#\#url.file#">
        </CFIF>
</cfif>


The variations between browser types are so the save as dialog shows the
correct file name for each type of browser. Notice I also use a directory
that is outside of the web directory which is a nice technique for securing
files. Works for me, hopefully it will work for you too.

Rick

-----Original Message-----
From: Maximov, Anton [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 14, 2000 5:43 PM
To: CF-Talk
Subject: RE: Force Download in Browser


i don't think u can use cfheader and cfcontent together. the latter one
overrides the former. tough luck. a solution would be to set a special
download directory and enforce the content type/content-disposition there.
see what happens.


anton maximov
programmer/analyst
IT, New Media


> -----Original Message-----
> From: Scott Becker [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, November 14, 2000 5:14 PM
> To:   CF-Talk
> Subject:      Force Download in Browser
>
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> ------_=_NextPart_001_01C04E88.336F47C0
> Content-Type: text/plain;
>       charset="iso-8859-1"
>
> Hello,
>
> Does anyone know how to force the browser to download a file?
> I'm using the following code, and it works for word documents, but
> not text files.
>
> <CFHEADER NAME="Content-Disposition" VALUE="attachment;
> filename=#get_record.File_Name#">
> <CFCONTENT TYPE="application/octet-stream"
> FILE="#filePath#\#get_record.File_Name#" DELETEFILE="No">
>
> The free drive sites accomplish this...
>
> Thanks!
>
> - Scott
>
>
----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to