Compress files (client side) and upload

心不动则不痛 提交于 2020-01-11 03:23:05

问题


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


回答1:


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/



来源:https://stackoverflow.com/questions/24226889/compress-files-client-side-and-upload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!