Skip to main content
wmkolcz
Inspiring
December 16, 2011
Question

Force Download from URL

  • December 16, 2011
  • 1 reply
  • 1228 views

Is it possible to force download an image from a URL instead of a network path?

I have secure images on a private SANS server that I can show through the URL (thanks to services granted by my server admins) but not have path (folder) access from the web server to the SANS so I cannot use a path to allow visitors to download images. Is there any other way to do it? Thanks!

This topic has been closed for replies.

1 reply

Community Expert
December 16, 2011

You can't do that directly from the CFCONTENT tag, but there's no reason why you can't fetch it with CFHTTP, store it locally, then use CFCONTENT to serve that.

Dave Watts, CTO, Fig Leaf Software

Dave Watts, Eidolon LLC
wmkolcz
wmkolczAuthor
Inspiring
December 16, 2011

I couldn't find a good example of how to save it locally so i could server it then delete the file. Do you know a good example or have one?

Inspiring
December 21, 2011

First (taken from the Adobe Docs)

     <cfhttp method="Get" url="http://www.adobe.com/adobe/accessibility/images/spotlight.jpg" path="c:\temp" file="My_Savedimage.jpg">

Get spotlight.jog and save into c:\temp\mysavedimage.jpg

Second :

<cfheader name="Content-disposition" value="attachment;filename=thefilenametodownload.jpg" />


<cfcontent type="image/jpg" file="c:\temp\My_Savedimage.jpg" />

Et voila