File upload & form data

D

Dan

Within a portlet, I have the need to upload one file to several
folders which can be selected in a list box. I have decided
to go with V1.1.1 of the Jakarta Commons File Upload classes.
My form contains several elements, including the multiple list
box. Here is my form tag:

<form method="post" enctype="multipart/form-data"
action="/DocUploadPortlet/UploadSelectedFiles.jsp">

Within the jsp, is there any way to get all of the items which
have been selected in the list box? Here is a snippet of code
from the jsp (listed in the "action" attribute above):

List items = upload.parseRequest(request);
Iterator iter = items.iterator();

while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
out.print("getFieldName(): " + item.getFieldName() + "<br>");
out.print("getName()" + item.getName() + "<br>");
out.print("getString()" + item.getString() + "<br><br>");
}

The above code does print the names of all form elements. But
in the case of the multiple list box, only its first selected value
is printed. Is there any way to get all of the selected values?

Thanks,

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top