Get count of selected files in dropzone

前端 未结 3 1484
南旧
南旧 2021-01-02 03:50

What I m trying to do is get a count of selected files in dropzone before upload them.

var count= myDropzoneNST.getAcceptedFiles().length;

相关标签:
3条回答
  • 2021-01-02 04:22
    var count= myDropzoneNST.files.length;
    

    will give you the total number of files in your dropzone.

    0 讨论(0)
  • 2021-01-02 04:22

    My experience is that the .get*Files() methods are not very accurate. The .getAcceptedFiles().length usage will return the current number of accepted files minus the one just having been added, if you call it from the addedFile() event handler, for example. This may be "as designed", but it makes the wording of "addedFile()" somewhat odd.

    0 讨论(0)
  • 2021-01-02 04:27
    // To access all files count
    myDropzone.files.length
    // To access only accepted files count
    myDropzone.getAcceptedFiles().length
    // To access all rejected files count
    myDropzone.getRejectedFiles().length
    // To access all queued files count
    myDropzone.getQueuedFiles().length
    // To access all uploading files count
    myDropzone.getUploadingFiles().length
    

    Get from document API here

    0 讨论(0)
提交回复
热议问题