I have a JSP/HTML form where there are 2 elements.One is a select dropdown and another is a File upload box(input type="file").I use POST method and enctype as form-multipart.Now I am able to access both the dropdown list and file using MultipartRequest object.No problem in that.
But when I don't upload any file and when I use a code in the reciecing form like
MultipartRequest multipartRequest = new MultipartRequest(request,".",5*1024*1024);
String dummySelect= (String) multipartRequest.getParameter("dummy");
out.println("<BR>select is "+dummySelect);
Enumeration files = multipartRequest.getFileNames();
Now ideally if I don't upload any file I should get an empty enumerator.Meaning
while(files.hasMoreElements())
should evaluate to false which is not happening.Can anyone tell me why? This results in an nullPointerException.