简体   繁体   中英

Compress files (client side) and upload

What HTML5/Javascript method I can use to upload and compress files on the client side?

The code to select multiple files:

Note: If you upload files occupying this method, the server is slow to compress files, to prevent overloading is preferable to compress from the client side

 <form method="post" enctype="multipart/form-data"> 
    <input type="file" name="fileselect[]" multiple="multiple">
    <input type="submit">
 </form>

The code as I'd like it to be:

<script>
 ...
</script> 
...
<form method="post" enctype="multipart/form-data"> 
    <input style="display:none" type="file" name="singlezipfile">
    <input type="submit">
 </form>

thanks in advance

There is no built-in functionality to achieve this...

But you can do this using FileReader API and javascript zip implementation like this one http://stuk.github.io/jszip/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM