wood burning stoves 2.0*
The moose likes Servlets and the fly likes Upload an Image file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Upload an Image file" Watch "Upload an Image file" New topic
Author

Upload an Image file

varkala prabhakar
Ranch Hand

Joined: Sep 08, 2001
Posts: 54
Hai all,
i have a problem with uploading the image file.
In my html file i use the tag like
<input type=file name=image> and in my servlet getParameter("image") , i get the path of the file and this works fine for my local system, but i want the file to be uploaded even from client machines.
can any one help me how to modify my html and servlet program so that i can store the image in my java web server.
thanks
prabhakar.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

1. Are you specifying in your HTML form that the enctype="multipart/form-data"
2. Are you specifying that the method="post"
3. out of the box, HTTPRequest doesn't understand a multipart/form-data submission, so are you using a home-made solution to parse the request appropriately, or do you have a package like com.oreilly.servlet?
priti doshi
Greenhorn

Joined: Aug 03, 2001
Posts: 6
You can use the jspsmartupload package. It has the code for uploading images. http://www.jspsmart.com
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
go on with mike's solution if using servlets...check on all things...
com.oreily..did help me...try it...

Malhar Barai
SOA & Java Book
varkala prabhakar
Ranch Hand

Joined: Sep 08, 2001
Posts: 54
than u mike,priti and malhar,
My Uploading got worked out with oreilly package. thanx for suggesting me the package.
prabhakar.
 
 
subject: Upload an Image file