View Full Version : Download image from URL

11-01-2007, 09:30 PM
I am trying to create a link to an image on our web server that will prompt the user to download or open the image when it is clicked. It is done automaticly with a .doc but when an image link is clicked it opens in a new window, as you probably know. I dont know if it is possible to just ad a tag (similar to the _blank tag) that does this or if I will have to use javascript. Any ideas would be great
Thank You

11-01-2007, 09:38 PM
Use .htaccess in the folder you want to force download of files.

<Files *.jpeg>
ForceType application/octet-stream
Header set Content-Disposition attachment

11-01-2007, 09:47 PM
I'm sorry I should have specified...The files are stored on an amazon S3 server So we do not have the ability to edit .htaccess

11-02-2007, 02:32 PM
I'm not familiar with Amazon hosting services. Sorry.

You could write a server side script that would force download of files based on the information given to the script.

Example would be http://yourhost/dir/download?f46se5uceZ6nunu6eKerEtra7uw28dRe WHERE "f46se5uceZ6nunu6eKerEtra7uw28dRe" points to a reference to the path of the file in a database. Be cautious using this method.