Export media files to a zip archive

There is a lot of information on how to export media files to a zip archive on wordpress. There are a bunch of ready-made plugins that will work and solve most of the tasks. But when there is a non-trivial task, then you need to either finish something ready, or make your own.
Suppose you have a wordpress website, and your website users can upload a file / document to their personal account. There can be both an image and doc, docx, in general, everything that is not prohibited by the security system, or by you personally. The implementation of loading media files done using ACF. Files are uploaded to the uploads folder without any division by months / years, etc. And you need to download these files / documents from the site as an archive. The name of each file corresponds to the name of the one who uploaded it.
So, the code:

As a result of this code execution, the archive with files should be downloaded on your PC.

© Copyright 2014 - All rights reserved