Thanks for the feedback, Wil...

I'm not sure however, that we're talking about the same thing.

I'm trying to automate going to a data vendor's site, logging in to their
web page, then triggering a link on the next page to cause a download
of a file to start... I'm the one doing the downloading of their files.

Am I misunderstanding what you wrote below?

Rick

Wil Genovese 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
>
>
>
>
>
> On Thu, Oct 16, 2008 at 2:09 PM, <[EMAIL PROTECTED]> wrote:
>
>   
>> From my experience you can't really control the save as/open dialog from
>> your end.  That is generally handled by the browser and OS as they see
>> fit.  File formats that can be opened right there in the browser
>> (images, html, text) tend to just open up in that window when you click
>> the link.  Most other file formats like zip, exe, or rar will generally
>> prompt you.  Some formats like doc, xsl, or pdf depend on if the user
>> has MS Office or Acrobat plugins installed.  If you want the user to
>> always "save as" I think the only thing to do might be to prompt them to
>> right click the link and choose save as.
>>
>> As far as prompting for the download immediately as soon as the page
>> loads, I often times use JavaScript to set the window.location.href to
>> the file and the browser will take care of the rest.  Of course, IE 7
>> tends to block those.
>>
>> ~Brad
>>
>> -------- Original Message --------
>> Subject: Is it possible to trigger a link on a web page and trigger a
>> download?
>> From: Rick Faircloth <[EMAIL PROTECTED]>
>> Date: Thu, October 16, 2008 1:45 pm
>> To: cf-talk <[email protected]>
>>
>> Hi, all...
>>
>> Before I go digging around and start trying to code a solution, I'd like
>> to know if what I'm trying to do is even possible.
>>
>>
>>
>>
>>     
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:314026
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