• Post Reply Bookmark Topic Watch Topic
  • New Topic

Upload an Image file

 
varkala prabhakar
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the jspsmartupload package. It has the code for uploading images. http://www.jspsmart.com
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
go on with mike's solution if using servlets...check on all things...
com.oreily..did help me...try it...
 
varkala prabhakar
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
than u mike,priti and malhar,
My Uploading got worked out with oreilly package. thanx for suggesting me the package.
prabhakar.
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!