Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Image upload .... again :-(

 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic