Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple file upload issue...

 
Srinivasa Kadiyala
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

http://www.nabble.com/multiple-file-uploads-with-one-property-t4021.html

Any updates / experience on this matter is appreciated.

Thanks in advance to all the concerned experts.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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) it.next();
fileNames.append(tempFile.getFileName()).append("\n");
}
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic