aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes how to save an image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "how to save an image" Watch "how to save an image" New topic
Author

how to save an image

Dinuka Arsakularatne
Ranch Hand

Joined: Aug 12, 2006
Posts: 198
hi everyone,

one small problem. can any one tell me how to save an image uploaded by a client in the server. say that the client clicks on a browse button and selects a file on his/her hard drive. how do we get that file and save it on the server?

thank you in advance


if who i am is what i have, and what i have is lost, then who am i?<br /> <br />SCJP 5.0<br />SCWCD 1.4<br />SCBCD preparing
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

request.getInputstream() or request.getReader() and read the body contents. Then save them.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Satish SN
Ranch Hand

Joined: Apr 19, 2005
Posts: 70
You can read the image from a web application using third party api provided by orielly
If you are using struts then it provides using which
you can read images/files in web application Google it for code using the above approaches.


Satish SN


Satish SN<br />SCJP 1.4 & SCWCD 1.4
Dinuka Arsakularatne
Ranch Hand

Joined: Aug 12, 2006
Posts: 198
ok, i know how to get the body content. but how do you save that file on your server. could some one provide a small piece of code or even a algo of how to save that file it would be really appreciated.

thank you
Kishore Balla
Ranch Hand

Joined: Jun 08, 2005
Posts: 165
File Upload


SCJP 5.0 : 88% My Story, SCWCD 1.4 : 94% My Story
kishoreballa.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to save an image