Copy pasted from [url http://jakarta.apache.org/commons/fileupload/using.html]commons file upload help page[/url]
// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
processFormField(item);
} else {
processUploadedFile(item);
}
}
For a regular form field, you will most likely be interested only in the name of the item, and its String value. As you might expect, accessing these is very simple.
// Process a regular form field
if (item.isFormField()) {
String name = item.getFieldName();
String value = item.getString();
...
}
ram.
im not familiar with commons-file upload by apache but the two html forms i mention can have separate actions.. with those two action one action can retrieve values from the textfields and the other from the file attributes.. example:
form1 action=servlet1
textfield1
form2 action=servlet2
file1
submit the two forms simultaneously
like
form1.submit();
form2.submit();
use ordinary button
then on servlet1 retrieve value from textfield
on servlet2 retrive value from file1