如何获取队列中文件大小的总数。我想允许用户只上传100 mb的文件,所以现在如果有人选择了大于100 mb的一个文件,这个代码效果很好,但当我选择两个60-60 mb的文件时,总共是120 mb,这不会显示任何错误。有相同的想法吗
$(function() {
$("#uploader").plupload({
runtimes : 'html5,flash,silverlight',
url : 'http://<?=$bucket?>.s3.amazonaws.com/',
multipart: true,
multipart_params: {
'key': '<?=$filepath?>${filename}', // use filename as a key
'Filename': '${filename}', // adding this to keep consistency across the runtimes
'acl': 'public-read',
'Content-Type': 'application/octet-stream',
'AWSAccessKeyId' : '<?=$accessKeyId?>',
'policy': '<?=$policy?>',
'signature': '<?=$signature?>'
},
// optional, but better be specified directly
file_data_name: 'file',
filters : {
// Maximum file size
max_file_size : '100mb'
// Specify what files to browse for
//mime_types: [
// {title : "Image files", extensions : "jpg,jpeg"}
//]
},
// Flash settings
flash_swf_url : 'js/Moxie.swf',
// Silverlight settings
silverlight_xap_url : 'js/Moxie.xap'
});
});
试试这个:
/* Check the queue after files added to see if the total size of all files combined exceeds allowed limit. */
var maxQueueSize = 681574400; // Size in bytes. This is set to 650MB.
uploader.bind('QueueChanged', function(up) {
if(uploader.total.size > maxQueueSize) {
alert("Total size of all files exceeds disc capacity! Remove some files!");
}
});
在这里找到它:http://www.plupload.com/punbb/viewtopic.php?id=757