House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

How to initiate download dialog when downloading jpg files?

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Butch Zaccheo
05/07/2004 12:09 PM

I¹m sure there¹s an easy way to do this, but I don¹t know what it is. I want the ³Save As² dialog box to open when a link to an image file is clicked on. Right now (as I¹m sure you are familiar with) it displays the image in the browser window rather than opening the ³Save As² dialog. Any help would be much appreciated. BZaccheo

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bryan F. Hogan
05/07/2004 12:11 PM

http://www.cfm-applications.com/expressive_v1_b2/index.cfm?entryID=2055 > I want the ³Save As² dialog box to open when a link to an image file is > clicked on. Right now (as I¹m sure you are familiar with) it displays the > image in the browser window rather than opening the ³Save As² dialog.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Butch Zaccheo
05/07/2004 01:36 PM

Hey Bryan... I get this error when I try and use the code you provided? I¹m not sure what the problem is... BZaccheo Invalid token ' ' found on line 5 at column 1. The CFML compiler was processing: *    a cfheader tag beginning on line 4, column 7. *    a cfheader tag beginning on line 4, column 7.   The error occurred in C:\Domains\edirolextra.com\wwwroot\sitedirector\site\details.cfm: line 5 3 : <cftry> 4 :      <cfheader name="content-disposition" 5 :           value="attachment;filename=#url.image#"> 6 :      <cfcontent type="application/unknown" 7 :           file="#request.siteDirectory##request.delimiter#images#request.del imiter#site_images#request.delimiter##url.image#" deletefile="no"> On 5/7/04 9:09 AM, "Bryan F. Hogan" <bryan.hogan@cfm-applications.com> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bryan F. Hogan
05/07/2004 02:01 PM

What is the value of url.image? Butch Zaccheo wrote: > Hey Bryan... I get this error when I try and use the code you provided? I¹m > not sure what the problem is...

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Butch Zaccheo
05/07/2004 02:09 PM

Actually I figured out the syntax error (strange characters when I pasted content) ... and it seems to be running fine now... but... when I run the script, it just loads the image in the browser window without initiating the dialog box. On 5/7/04 10:59 AM, "Bryan F. Hogan" <bryan.hogan@cfm-applications.com> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bryan F. Hogan
05/07/2004 02:15 PM

Doing it like below returns the image in the browser? test.cfm <a href="download.cfm?image=test.jpg">Download test.jpg</a> download.cfm <cftry> <cfheader name="content-disposition" value="attachment;filename=#url.image#"> <cfcontent type="application/unknown" file="#expandPath('..')&'\documents\'&url.image#" deletefile="no"> <cflocation url="test.cfm" addtoken="no"> <cfcatch type="any"> </cfcatch> </cftry> Butch Zaccheo wrote: > when I run the > script, it just loads the image in the browser window without initiating the > dialog box.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Butch Zaccheo
05/07/2004 02:20 PM

I probably should give you a little more info.... I¹m testing this in IE 5 OSX... It works fine on the pc side but not on the mac side... is there another way of doing this.. maybe with a javascript? On 5/7/04 11:11 AM, "Bryan F. Hogan" <bryan.hogan@cfm-applications.com> wrote: ----- Excess quoted text cut - see Original Post for more ----- the >> > dialog box.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bryan F. Hogan
05/07/2004 02:27 PM

I don't know of another way. What is needed for this to work is to trick the browser into thinking it is not a known document type. Try this content-type "application/x-msdownload" or "do the google" (c) by me ;-) http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=content-type%2Bmac%2Bie Butch Zaccheo wrote: > I probably should give you a little more info.... I¹m testing this in IE 5 > OSX... It works fine on the pc side but not on the mac side... is there > another way of doing this.. maybe with a javascript?

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Butch Zaccheo
05/07/2004 03:24 PM

thanx again for the help bryan... I don¹t think there is a clear way to make it work for mac browsers... I¹ll have to try a different route... On 5/7/04 11:24 AM, "Bryan F. Hogan" <bryan.hogan@cfm-applications.com> wrote: ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

February 08, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29