What I m trying to do is get a count of selected files in dropzone before upload them.
我想要做的是在上传之前获取dropzone中所选文件的数量。
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.
我可以使用这一行来获取上传文件的数量,但我想要做的是在上传之前获取所选有效文件的数量。
3 个解决方案
#1
18
var count= myDropzoneNST.files.length;
will give you the total number of files in your dropzone.
将为您提供dropzone中的文件总数。
#2
3
// 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
从这里获取文档API
#3
0
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.
我的经验是.get * Files()方法不是很准确。如果从addedFile()事件处理程序调用它,则.getAcceptedFiles()。length用法将返回当前已接受文件的数量减去刚刚添加的文件数量。这可能是“按设计的”,但它使“addedFile()”的措辞有些奇怪。
#1
18
var count= myDropzoneNST.files.length;
will give you the total number of files in your dropzone.
将为您提供dropzone中的文件总数。
#2
3
// 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
从这里获取文档API
#3
0
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.
我的经验是.get * Files()方法不是很准确。如果从addedFile()事件处理程序调用它,则.getAcceptedFiles()。length用法将返回当前已接受文件的数量减去刚刚添加的文件数量。这可能是“按设计的”,但它使“addedFile()”的措辞有些奇怪。