0

一旦用户从计算机中选择了文件并单击,我需要知道如何获取文件选择队列,因为我想将消息显示为“上传的文件 1/200”,但我不知道如何获取选择的文件总数。

我只知道我有这些方法(onSubmit、onProgress、onComplete、onError),但没有一个对我有用:

// url of the server-side upload script, should be on the same domain
    action: '/server/upload',
    // additional data to send, name-value pairs
    params: {},

    // validation    
    // ex. ['jpg', 'jpeg', 'png', 'gif'] or []
    allowedExtensions: [],        
    // each file size limit in bytes
    // this option isn't supported in all browsers
    sizeLimit: 0, // max size   
    minSizeLimit: 0, // min size
    abortOnFailure: true, // Fail all files if one doesn't meet the criteria

    // set to true to output server response to console
    debug: false,

    // events         
    // you can return false to abort submit
    onSubmit: function(id, fileName){},
    onProgress: function(id, fileName, loaded, total){},
    onComplete: function(id, fileName, responseJSON){},
    onCancel: function(id, fileName){},
    onError: function(id, fileName, xhr){}

    messages: {
        // error messages, see qq.FileUploaderBasic for content            
    },
    showMessage: function(message){ alert(message); }
4

1 回答 1

0

我知道如何选择文件。

在 onSubmit 函数中制作 window.event.target.files:

onSubmitPDF: function( id, fileName ){
  console.log(window.event.target.files);
}

window.event.target.files 为您提供当前文件选择队列的信息。

于 2014-04-02T14:12:23.000 回答