Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing images in database

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ???
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic