To secure a file before downloading, it must be executed on the client side. PHP is useless because PHP is just a server.
Option 1: you ask your clients to download these files already archived (it seems this is not what you want).
Option 2: you need a way to do this on the server using javascript code - to be honest, I doubt that there is a simple solution for this. Maybe the zip data stream may work, but this requires special permissions for the script (fe ActiveX), and today it will not allow the browser to date.
Thariama
source share