I need to send data from a form to a database but... this form have a field input also. I trying to send all the data together (image and input text values) but I can't.
Is to say in the database I just get the image but not the input text values! I read in someplace that is not possible but...I had seen that working fine in some websites!
What is wrong?
Here the code that I am -testing:
1)the jsp form:
Stefan Evans wrote:Much as you may hate it, my suggestion would be to throw away half of this code, and use a library to parse the response for you.
The commons fileupload component is a commonly used one.
That library enables you to read both the uploaded file and the parameters sent along with it.
I will read about Jakarta FileUpload. Already I had seen it before but I never thinked that I would be diffcult submit values an images at the same time.
I will try these examples: example1 and example2 I hate when the examples just show how submit images and not data too!!!
If anyone know other alternative please let me know.
sudhir nim wrote:Again, if you are just trying out, or if you have choice to use tomcat 7 (if you are starting a new project or just learning servlets),
Try out the @MultipartConfig and built in file upload support in servlet 3.0 Spec.
It has made life really easier, you will not need any additional library like commons file upload or any other multipart parser.
Nice tips specially @MultipartConfig. I will continue trying fileupload library while I change to tomcat 7.
Also I had found other good tips here if anyone need help must check the link.