aspose file tools*
The moose likes Servlets and the fly likes Input: text and file Uploading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Input: text and file Uploading " Watch "Input: text and file Uploading " New topic
Author

Input: text and file Uploading

Mark Henryson
Ranch Hand

Joined: Jul 11, 2005
Posts: 200
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.

Name _______

Age _______

Address _______

Country _______

City _______
--------
Photo Upload ________ |Browse|
--------
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Input: text and file Uploading