If I understand you question correctly, you want to download multiple documents at once?
There is an existing widget for this, the 'Multi-file download': https://appstore.home.mendix.com/link/app/60747/
Alternatively, you could create a java action (https://stackoverflow.com/questions/18417266/how-to-create-zip-files-using-list-of-input-streams might help), but I'd try out the existing option first
I am able to accomplish the task by creating few Java actions.
First, I created an empty folder using java action. Then, I used second java action inside the loop for creating a blank file inside that folder. And, finally using CommunityCommons.FileFromFileDocument, I saved the uploaded document in newly created blank file.
@Ronald, I have to create persistable files inside a dynamically created folder and that is why I was unable to pass the file name to the FileFromFileDocument as it has to be an existing file with same name and extension. And my application accepts images of different format (jpg, peg, png and pdf)
Thank you guys for the help :-)