All,
I have created an actionForm and action to handle multiple file uploads.
I want to save each file I uploaded to my local drive so I created a loop to 
do just that.
Below is the code snippet.
***************************************************************************

int numFilesUpload = 10;
int index = 0;
/* Files to upload */
FormFile[] files = new FormFile[numFilesUpload];

ExpUploadActionForm expUploadActionForm = (ExpUploadActionForm)
actionForm;

CommonsMultipartRequestHandler handler = (CommonsMultipartRequestHandler)
expUploadActionForm.getMultipartRequestHandler();

Hashtable fileCounter = handler.getFileElements();
int index=0;
for (Enumeration en = fileCounter.elements(); en.hasMoreElements(); ) {
System.out.println("In action " + en.nextElement ());
System.out.println("The index is "+index);
try {
files[index] =(FormFile) en.nextElement();
inputStream = files[index].getInputStream();
bos = new FileOutputStream(dirName + files[index].getFileName()); 
}
However I am getting the following error 
********************************************************************
 
in action ajpgFile.jpg

The index is 0

the session id is FB0A0FFD7AB57B40F4651AD2FEEC0A27

In action ajpgFile.jpg

The index is 1

- Unhandled Exception thrown: class java.util.NoSuchElementException

StandardWrapperValve[action]: Servlet.service() for servlet action threw 
exception

javax.servlet.ServletException: Hashtable Enumerator

javax.servlet.ServletException: Hashtable Enumerator

 Any idea what is causing the error and how to fix it?

Reply via email to