Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to save an image

 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
request.getInputstream() or request.getReader() and read the body contents. Then save them.
 
Satish SN
Ranch Hand
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 165
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
File Upload
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic