yatinbc
yatinbc

Reputation: 625

JSP:how do i store image from HTML img tag to database as blob

I have one web application for capturing image from webcaam using flash player. after capturing image from webcam I am displaying it's preview in HTML img tag and also capturing image url in hidden form fields which I am using to store that image in my database. But my query is how do I store that image from that image tag as blob in my database and most of the solution I reviewed in that I found of storing image in database were uploading image from system and then storing and retrieving it from databse.

Upvotes: 2

Views: 1505

Answers (1)

MaVRoSCy
MaVRoSCy

Reputation: 17839

In order for this to work, you need to create a <form enctype="multipart/form-data"> . In your html, insert a file upload control. Then you have to select the file to upload (this cannot be done automatically because of security reasons in most browsers). And then submit your form.

When form is submitted, you can read image from request and store it to db ( how to upload a image in jsp and store database as blob )

Upvotes: 2

Related Questions