繁体   English   中英

如何获取队列的总文件大小而不是plupload中的单个文件大小

[英]how to get total file size of queue not single file size in plupload

如何获取队列中的文件大小总数。 我想允许用户仅上传100 mb的文件,所以现在如果有人选择一个大于100 mb的文件,此代码效果很好,但是当我选择2个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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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