I am developing an application in JSP and Servlets. Below is the problem, I am encountering.
I am having a form with 5 to 6 text boxs. I am entering the value and getting the value from it using getParameter and store it in the database. Now I want to add another input field of type file, of wwhich the user will browse the images from the desired locations and while pressing the submit button the photo will be copied to the webapps/images folder(which i have done it) and the image name will be stored in the database. For this I am using multipart request. I want to add all the values 6 text box + 1 file input type(all in one form) in the DB. Since for file I am using multipart request the value for the other 6 text boxs are not coing thru getParameter. How to overcome this? Below is the example form I am using.
City _______ -------- Photo Upload ________ |Browse| --------
You need to have a look at the docs for the API you are using to manage the file upload. The problem in multipart requests is that all of the information comes all jumbled together. The default mechanism for getting parameters in the container can't handle it.
Usually it is just a case of changing request.getParameter("thing") to reqWrapper.getParameter("thing") where reqWrapper is of course the third party API you've plugged in.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com