在使用php或后台进程使用exec('python')上传到服务器之前,从客户端机器压缩所选文件夹?

Created php upload which accepts only rar,zip and tar compressions. But every user is not able to compress and upload to my website. Is there any way to compress the user selected folder from clients machine and then start upload to website. Like dump any script or application to clients machine for compressing folder. Let me know if any suggestions.

Since PHP is server-side you can not zip anything client-side with it. However, simple Google query has shown me this JS library: https://stuk.github.io/jszip/

Example says this:

var zip = new JSZip();
zip.file("Hello.txt", "Hello World
");
var img = zip.folder("images");
img.file("smile.gif", imgData, {base64: true});
zip.generateAsync({type:"blob"})
.then(function(content) {
    // see FileSaver.js
    saveAs(content, "example.zip");
});

Simple, isn't it? Then all you have to do is to take this "example.zip" from javascript and upload it to your server.

Hope I helped you a little :)