简体   繁体   中英

Get files selected queue valums fileupload.js

I need to know how to get the files selected queue once the user has selected the files from computer and clicks on, because I want to show a message as "Uploaded files 1/200", but I don't know how to get the total of the files selected.

I just know I have these methods (onSubmit, onProgress, onComplete, onError) but none works for me:

// 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); }

I know how to get the files selected.

In onSubmit function make window.event.target.files:

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

window.event.target.files gives you the information of the current files selected queue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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