我需要知道在用户从计算机中选择文件并点击后如何获取所选文件的队列,因为我想显示一条消息为"上传的文件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); }
答案 0 :(得分:0)
我知道如何选择文件。
在onSubmit函数make window.event.target.files:
onSubmitPDF: function( id, fileName ){
console.log(window.event.target.files);
}
window.event.target.files为您提供当前文件所选队列的信息。