• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Storing images in database

 
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ???
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic