Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upload multiple files in Struts 1

How do I upload multiple files in Struts 1's ActionForm? I have to show multiple options of file uploading and save them at time. I don't want to show input box for file in Struts 1?

like image 223
user1172963 Avatar asked Jan 27 '12 07:01

user1172963


People also ask

How do I post multiple files?

Windows – in Files Explorer, select multiple files > right-click > Send to > Compressed (ZIP) folder. macOS – in Finder, select multiple files > Ctrl +select or right-click > Compress n items.

How do I upload multiple files to Salesforce?

In Lightning, you can upload multiple files to a Content Library by going to the Files Tab > Selecting the LIbraries filter > Select the Library you'd like to upload to. The Add Files actions will allow multi-file upload to the Library or folder within the Library which you select.


2 Answers

In Struts if you want multiple of anything, you need to create an array of the type you want.

In file upload, you need to have an array of FormFile and multiple input text boxes with the name to the same Struts ActionForm FormFile attribute.

like image 101
Buhake Sindi Avatar answered Sep 19 '22 16:09

Buhake Sindi


You can either use JQuery File Upload which can be easily embed with JSP and can be used with FormFile object of struts.
Or You can define an array of FormFile objects in the ActionForm class.
But for that you have to show multiple input boxes for files.

like image 31
Naved Avatar answered Sep 20 '22 16:09

Naved