Get count of selected files in dropzone
Asked Answered
B

3

16

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

var count= myDropzoneNST.getAcceptedFiles().length;

I can get a count of uploaded files using this line, but What I m trying to do is to get count of selected valid files before upload them.

Bellinger answered 28/4, 2015 at 4:18 Comment(0)
N
27
var count= myDropzoneNST.files.length;

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

Northwestward answered 28/4, 2015 at 4:25 Comment(0)
H
19
// 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

Hypnotize answered 26/7, 2017 at 8:56 Comment(0)
C
1

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.

Chromatin answered 29/3, 2018 at 9:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.