i want to create a project that accepts the image and save it into a database and retrieve

1.i created a table in mysql database with datatypes varchar and blob.
2.to save the file into a blob datatype the file is to be converted into a inputstream
3.i created a html page with two inputs text for imagename and file for image
4.i created a servlet to get the inputs
5. iam getting the image name but i am not getting the image. i googled for it and got that the file can be retrieved in the form servletinput stream

  1. my problem is how to convert the servlet input stream into the input stream and send to the database
  2. aslo how can i retreive the image back from the database

Edited by ~s.o.s~: moved to jsp forum

4 Years
Discussion Span
Last Post by bdheeraj

I should mention that the more conventional solution to this issue is to store a URL or some other sort of path to the image file, rather than the image itself. This avoids the whole issue entirely, as you then would simply access the image file normally. Would this be an option for you, or do you need to have the image data in the database itself?


@schol-R-LEA i was thinking of storing the image data. but can u tell me how to store the path?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.