I have a problem in uploading files using struts2. I have multiple file tags like
<s:file name="fileUpload_5534" multiple="multiple"/>
<s:file name="fileUpload_5585" multiple="multiple"/>
<s:file name="fileUpload_5595" multiple="multiple"/>
These file tags are created dynamically and again can have multiple files uploads as I have specified multiple="multiple"
. Can anyone suggest the solution for this kind of uploads.
You can upload multiple files from a single
<s:file>
element withmultiple="multiple"
like described here.You can also upload multiple files from many
<s:file>
elements (that allow a single file for each one) in the same way, handling the names of the<s:file>
s to point to a list on the Action.Do you really want to upload a
List
s ofLists
ofFile
s ?If yes, I suggest you to model an object, like
MyFileListObject
, containing the lists of data needed:and then expose a
List<MyFileListObject>
through the Action.Alternatively, you can granulate it more, defining a new object, like
MyFileObject
,,listed in
MyFileListObject
:and then expose a
List<MyFileListObject>
through the Action.But it seems overkill to me... which kind of page should let many
<input type="file"/>
upload many files each one in a single post ?