I have a code base which currently uploads file using Post and has enctype as multipart/form-data. Now I need to include some form items i.e. some parameters will also be passed along with the file upload. I have my html form created out but I cannot use request.getParameter because it is a multipart form. Could anyone suggest me how do I pass parameters along with my upload file. I am providing the codes below. Please suggest me how to get around based on compatibility of my codes
if (!ServletFileUpload.isMultipartContent(request)) {
throw new CustomUploadException("Not a file upload request");
}
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iter = upload.getItemIterator(request);
while (iter.hasNext())
{
FileItemStream item = iter.next();
if (item.isFormField() == false &&
item.getFieldName().equalsIgnoreCase("xmlfile"))
{
String fileName = item.getName();
myBean.setFileName(fileName );
}
}