Computing.Net > Forums > Web Development > saving a jpeg locally

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

saving a jpeg locally

Reply to Message Icon

Name: protos
Date: January 11, 2005 at 03:07:34 Pacific
OS: windows XP
CPU/Ram: pentium 4 /540MB
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Khalid
Date: January 11, 2005 at 14:29:10 Pacific
Reply:

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!


0

Response Number 2
Name: protos
Date: January 11, 2005 at 18:17:53 Pacific
Reply:

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


0

Response Number 3
Name: Khalid
Date: January 12, 2005 at 07:49:10 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: saving a jpeg locally

PHP - saving a file www.computing.net/answers/webdevel/php-saving-a-file/2142.html

save jpegs from a non right click www.computing.net/answers/webdevel/save-jpegs-from-a-non-right-click-/715.html

saving a website to disk www.computing.net/answers/webdevel/saving-a-website-to-disk/1366.html