如何限制最大“总数”文件大小在dropzone.js? [英] How to limit the max "total" file size in dropzone.js?
问题描述
唯一的问题是,在配置中有一个maxFileSize选项,它限制了单个文件大小。
并且由于服务器(php.ini)也有一个全部的文件大小限制,我不知道如何限制在dropzone.js?
非常感谢。
http://www.dropzonejs.com /#configuration-options
我只看到 maxfilesize
, paralleluploads
和 maxfiles
需要跟踪添加的文件大小,也许使用
this.on(addedfile,function(文件){//执行任务//});
...计算文件大小,如果超过总文件大小,则禁用提交按钮。
document.getElementById('dropsubmit')。disabled = false;
您可以使用addedFile和removedFile事件来更改跟踪文件大小的变量随着文件被添加和删除。根据累计大小,将提交按钮设置为true或false。
Currently I use dropzone to handle the file upload in Jquery. So far it works fine.
The only problem is that, in the configuration there is a maxFileSize options , it limit the "single" file size.
And as the server (php.ini) also has a "total" file size limitation, I wonder how to limit that in the dropzone.js?
Thanks a lot.
http://www.dropzonejs.com/#configuration-options
I only see maxfilesize
, paralleluploads
and maxfiles
I think you may need to keep track of the file sizes as they're added, maybe using
this.on("addedfile", function(file) { // perform task // });
... tally the file sizes and disable the submit button if the total file size is exceeded.
document.getElementById('dropsubmit').disabled = false;
There are "addedFile" and "removedFile" events you could use to alter a variable tracking the file size as files are added and removed. depending on the cumulative size, set the submit button to true or false.
这篇关于如何限制最大“总数”文件大小在dropzone.js?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!