This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
When I submit multipart content with the form data , it does not seem to recognize
the form data. I am trying to upload the file using jquery file upload scripts, is there any other way I can
handle it ?
When you submit a multi-part form, the request's getParameter() family of methods cannot parse the data (it's in the wrong format). Rather, the file upload library you are using should have an API to make the values available. If you are parsing the request data yourself, instead of using a file upload library, you need to do it yourself.
As I have already explained, getParameter() will not work. You need to use the API provided by the upload library.
Joined: Feb 19, 2009
You were absolutely correct. I changed the code to reflect the new apis.
However now, for the file content it gives me an exception.
If I cast it (((FileItem) item).write(uploadedFile);) gives me an exception if I dont it gives an error.
Exception: org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl$FileItemStreamImpl cannot be cast