Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I want to replicate the behave the behaviour of
the "save as" option when you right click on an image in a webpage, using a button.
I have a button below the image, which when clicked brings up the "save-as" dialog box and allows the user to save the image locally.Is this possible ?
Cheers
Colm

This can be done with server-sided scripting. Normally, when you link an image, the image will appear in the window because the server sends some http-headers wich tell the browser what to do with the file.
You can manually alter these headers with a server-sided scripting language, like PHP or ASP.In PHP you can use something like:
header("Content-Disposition: attachment; filename=image.jpg");
readfile("image.jpg");More information can be found on php.net , or if you still dont know what to do, post back and someone will post a full example here.
Good luck!

Thanks for the reply :
What you're saying is that when an image link is clicked it looks at the header and if it sees that its an image it will display it instead of bringing up the save-as box ?Can you give me an example ? I'm using coldfusion for the serverside stuff but anything will do ..........
Cheers
Colm

I have no experience with coldfusion, but googling comes up with some links you may find interesting.
By the way:What I'm saying is that when an image link is clicked the server sends a normal header and if the server sees that its an image it will normally sends a header so the browser will 'know' what to do and displays it instead of bringing up the save-as box ? If the server sends some other headers, the browser knows 'what to do' i.e. show the save-as box.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |