File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Multiple file upload issue... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multiple file upload issue..." Watch "Multiple file upload issue..." New topic

Multiple file upload issue...

Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
I have to upload and download mutliple files to and from a database. I am planning to use stuts html-form. I found the following artcile describing an issue with the file-uploading.

Any updates / experience on this matter is appreciated.

Thanks in advance to all the concerned experts.

Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Have you tried it? My project has a few pages with multiple file tags and that works fine (I am using Struts 1.1). The bug referenced seems to be related to multiple file tags with the same property name and uploading multiple files with one file tag (I did not know that some browsers supported that...I could not get it to work in IE 6.0).

- Brent
Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
I am getting Class Cast Exception with the following code...

<<< Starts here >>>

private String resetFileList(FormFile currentFile, HashMap filesData) {
Iterator it = filesData.keySet().iterator();
StringBuffer fileNames = new StringBuffer();
while (it.hasNext()) {
FormFile tempFile = (FormFile);
return fileNames.toString();

<<< ends here >>>>

I am using a html:file in my form. when the user submits the file for upload, in action I am storing the FormFile in to the session and reading adding the new file to the HashMap and setting the HashMap to the session again. This way I keep track of all FormFile objects and push them once, when the user submits the button.

I do not understand why I am getting class cast exception when I am reading the FormFile object from the HashMap i stored to the session.

Thanks in advance.
I agree. Here's the link:
subject: Multiple file upload issue...
It's not a secret anymore!