Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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