How to make a link to a jpg picture download it?

I'm getting a lot of new problems today, so here is my next question, how do i forca browser to save a jpg picture from a link instead of automatically opening it in the browser itself?

The best I could find is this link:, but It doesn't work. Any good suggestions how to do it?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Michel PlungjanConnect With a Mentor IT ExpertCommented:
<a href="saveImage.php?url=image1.jpg">Save image</a>

and in php:

$url = addslashes($_GET["url"]);
header('Content-type: content-type:octet-stream');
header('Content-Disposition: attachment; filename="'.$url.'"');

Open in new window

i had already answered a similar type in experts. first thing tell is this link a direct link  i mean in html u have the url path or not.
please refer to my answere and this question in below URL of EE:
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

GuanoFunAuthor Commented:
Yes, I have multiple logotips stored in JPG, GIF and other formats wich link directly to them. They are accually op the same server just in a /image/ directoy.

But as normaly browser acts when you click an image link - it opens in browser first. I want a person not needing to right-click and choose save target as, but with normal left-click to have act as it would have chosen save-targe-as already.

Basically, the useronly has to choose where to save the file if he wants to. I dont want to automatically download anything for him in any way, I just want to make things easier for the user ;)
the above url has all the answere's
GuanoFunAuthor Commented:
I read that, thanx, but i guess that is asp programming language which im totally not familiar with ... can you maybe axplain me in more detail how i can get that on my server and what to do with it?

I guess i know something just in php, css and javascript :(
i am not good at php... sorry
GuanoFunAuthor Commented:
hmm... maybe you can explain what do with the asp script then?

Raised points to 250, since I see it won't be as easy as I though
-------This   creates a file object and gets all its content as binary input
 Set oStream = Server.CreateObject("ADODB.Stream")
                oStream.Type = 1

------------Setting the reponse buffer so what the whole is downloaded properly------------
                Response.Buffer = true
 -----telling the browser/response that content could be anything , the browser should interpet depending on file extension.In your case u can set Jepg see belloe commented code:
//response.ContentType ="image/jpeg"

                Response.ContentType = "whatever"
adding the header for download telling rhe browser the  file should considered as attachment not as inline hence it show a save dialog, also i specify the the name as which it should be stored
                Response.AddHeader "content-disposition","attachment; filename=fname.ext"
                end select

---------------             reading file object data to response writer which will send the data to browser  
                Response.BinaryWrite oStream.Read
-----------clearing all objects/file objects used.....
                oStream.Close : Set oStream = Nothing
GuanoFunAuthor Commented:
thanks a lot, the best solution es really the easiest. works just perfect!

All Courses

From novice to tech pro — start learning today.