wood burning stoves 2.0*
The moose likes Servlets and the fly likes Storing images in database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Storing images in database" Watch "Storing images in database" New topic
Author

Storing images in database

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 759
Hi,

I'm using MySQL as backend,

JSP Code :



Servlet Code :



Servlet Outout in console :



How do i store image in database, I've created one field in table for imahges as follows



Can anybody guide me for the same ???


Jigar Naik


David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

are you using a multipart request? If not, or it doesn't ring a bell, then your upload will not work and won't get to the server. You should check our FAQ entry on FileUpload
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 759
getting folling error :



my jsp code :

upload.jsp



Servlet code :




can anybody resolve this error ???

and how this code works ??? i m not saying anything like getParameter("upload"); What if my form is having some other input type=text ???
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream

Learn to read stack traces.

Find the jar containing this file, add it to the container.
Seevai Nalinda
Greenhorn

Joined: Apr 12, 2007
Posts: 1
Hi Jigar,

Download the I/O library (commons-io-1.2.jar) from Apache Commons project and stick into the lib directory. That will resolved the NoClassDefFoundError exception.

File upload handles in a different manner. If you want to retrieve the standrd form items such as text fields you have to access them using the isFormField method of FileItem class.



Hope this would help.

Seevali
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Storing images in database