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

Recommended Answers

All 2 Replies

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.