• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

image and form data upload problem

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day experts, i want to upload image and forms input to database using apachae method but it returns an error display below



here is my main code

For name and city, i used text datatype.
For image i used longblob

I dont know whether the problem is from datatype i used for name and city.

Please what do I do. Thanks mutago
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Step 1: move all the Java code out of the JSP and into a Java class where it belongs. Java code in JSPs has been discredited for over 8 years now. Time to update your JSP knowledge.

Step 2: Once in a Java class, the syntax and other errors will likely be easier to diagnose.
 
Sheriff
Posts: 28326
96
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

muntago Richard wrote:I dont know whether the problem is from datatype i used for name and city.



First of all, you should follow Bear's advice and get that code into a servlet where it belongs. But as for the datatype you used for name and city: that's what the error messages are telling you.
You didn't use any datatype for them. See those lines numbered 17 and 18 in your posted code? Those aren't declarations, they are comments.
They don't declare datatypes for name and city, they don't do anything.
 
muntago Richard
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your guidance. But this programme was an assignment and i was ask to do it with Jsp technology. But if insist on moving it to java servlet.Then no problem. How ever why i comment this line
is because I was thought theortically that get parameter cannot work with mutipartform.
but when i uncomment the above 2 lines of code and secondly by removing
line 42 and 43 shown below
because i cannot convert varchar datatype to byte
the programme runs and uploads image into database but name and city returns null. Honestly,this is a very big problem for all the students.It seems apache common upload strategy is too complicated.

In a nut Shell, if You think datatype is the bone of contention. what datatype should i used for
Image,name and city.
below is the modified code.
thanks I appreciate your time and concern

 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic