• 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

Uploading an Image

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to upload an image from the client machine into the database as blob using the JSPs.
Can somebody gimme a sample code how to proceed.
Thx in advance
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mary,
Basically you want to upload to a servlet not to a JSP. Consider the following client application code that receives the file name to upload and the URL of the servlet as arguments ...

Then you would write a servlet to read the input stream and then store the bytes to a file or possibly as a blob in a database as follows ...

[This message has been edited by Bill Siggelkow (edited December 04, 2001).]
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Siggelkow,
My requirement is like this ----
I have a data entry screen on the browser.In the screen I have a field to upload the company logo .The company logo will be on the users machine.How do i read the image on the server side(using servlets/jsp) and update my database .
Can Ur sample program is flexible for this?
PL lemme know
Thx in advance

 
Bill Siggelkow
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mary,
No ... the program I gave you is a client-side application ... if you are uploading via an HTML form from a browser your servlet needs to process what is known as multipart form data ... It is non-trivial but you can use classes from oreilly to do help ... go to http://www.servlets.com
Also, you may want to look into the Struts web application framework http://jakarta.apache.org/struts
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can U pl tell me how to update a blob into the database
I have a data entry screen on the browser.In the screen I have a field to upload the company logo .The company logo will be on the users machine.How do i read the image on the server side(using servlets/jsp) and update my database(i need to update the DB not insert into DB) .
Thx in advance
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic