• Post Reply Bookmark Topic Watch Topic
  • New Topic

Image upload .... again :-(  RSS feed

 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys. I have searched the forum and found topics like this one but I'm still confused. Maybe some of you guys can explain to me better.
this is what I want to achieve.
1o.) there's a form with a file upload (an image -gif or jpeg- to be precise)
2o.) As soon as the user submits the form, a servlet will handle the request, take the image and store it in a database (MySQL).
questions :
* I've found the oreilly classes, particularly this link, but I understand nothing . There are so many classes that you get confused, you don't know wich one you should use. Which one is the one I need?
* I want to restrict the user to upload ONLY images (gif or jpeg).
* Can you guys provide me with some code 'snippets' to start from, I really don't have a clue with this...
 
Ankur Goyal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use jsp smart upload component. simple and easy to use. This code shud make it clear.

u can convert it to work with servlets.
As for restictions on file type, put an extension check or check the Mime type of file.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!