If you want to force the "Save File" dialog appear you can use
"application/unknown" as the content type for cfcontent. At least that
behaves on windows boxes.

EX: <cfcontent type="application/unknown"><cfoutput>#yourdata#</cfoutput>




On Thu, Oct 16, 2008 at 3:35 PM, Wil Genovese <[EMAIL PROTECTED]> wrote:

> Actually you can control the way a link opens if your trying to push a file
> when a user clicks a link. If the link is to a coldfusion page that then
> grabs the file sets header info and content type.
>
> I do this for mp3 files.
>
> download.cfm
> --start file--
> <cfparam name="url.songname" default="">
> <cfif trim(url.songname) neq "">
>  <cfset clipname = "#songname#.mp3">
>  <cfset clipfolder = "/var/offsite/musicfolder/songs/">
>  <cfif fileExists(#clipfolder##clipname#)>
>    <cfdirectory action="list" directory="#clipfolder#" filter="#clipname#"
> name="fileSize">
>    <cfheader name="Content-Disposition" value="Attachment;
> filename=#clipname#">
>    <cfheader name="Content-Length" value="#fileSize.size#">
>    <cfheader name="Expires" value="#Now()#">
>    <cfcontent type="audio/mp3" file="#clipfolder##clipname#"
> deletefile="No">
>  </cfif>
> </cfif>
> --end file--
>
>
> Note the cfheader tag that has the filename.  Value="Attachment;
> filename=3clipname#">
>
> The keyword "Attachment" forces ALL browsers to open the Save dialog.  The
> other option you can use is "Inline". This allows the browsers to open
> files
> like PDF's inline instead or forcing a download.
>
> I also grab the file size use cfdirectory so I can push that to the browser
> as well. This allows the browser to properly display the download size,
> estimated download time and download progress.
>
>
> Wil Genovese
> Sr. Web Application Developer
>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314016
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to