In my project, I have some files related to items on Server as shown below:
Item-1 => file1.txt, file2.pdf and file3.doc
Item-2 => file4.pdf, file5.ppt
Item-3 => file6.txt, file7.docx and file8.ppt
....
I can get the above items by $this->getAllItems()
and then loop through each item.
I am trying to compress all these files in a structured way. So, that the user can understand files belong to which items.
What I am trying to do is keep the files related to their respected items in a folder and wrap them in a "main" folder (this should happen in a temporary path) then Compress it and let the user download the compress folder. So, that the files will be in structured way as shown below:
main
Item-1
--> file1.txt
--> file2.pdf
--> file3.doc
Item-2
--> file4.pdf
--> file5.ppt
Item-3
--> file6.txt
--> file7.docx
--> file8.ppt
While searching here, I got a link which does compress the files (but not folders) in a temporary path and make the compressed folder available to download.
PS: The compressing should happen for every download request by users.