Formdata looks like this , when you use console.log(formData),
FormData {
append: function
}
__proto__: FormDataappend: function append() {
[native code]
}
arguments: nullcaller: nulllength: 2name: "append"
__proto__: function Empty() {}
apply: function apply() {
[native code]
}
arguments: nullbind: function bind() {
[native code]
}
call: function call() {
[native code]
}
caller: nullconstructor: function Function() {
[native code]
}
length: 0name: "Empty"
toString: function toString() {
[native code]
}
__proto__: Object < function scope > < function scope > Global: Windowconstructor: function FormData() {
[native code]
}
__proto__: Object__defineGetter__: function __defineGetter__() {
[native code]
}
__defineSetter__: function __defineSetter__() {
[native code]
}
__lookupGetter__: function __lookupGetter__() {
[native code]
}
__lookupSetter__: function __lookupSetter__() {
[native code]
}
constructor: function Object() {
[native code]
}
hasOwnProperty: function hasOwnProperty() {
[native code]
}
isPrototypeOf: function isPrototypeOf() {
[native code]
}
propertyIsEnumerable: function propertyIsEnumerable() {
[native code]
}
toLocaleString: function toLocaleString() {
[native code]
}
toString: function toString() {
[native code]
}
valueOf: function valueOf() {
[native code]
}
get __proto__: function __proto__() {
[native code]
}
set __proto__: function __proto__() {
[native code]
}
So, There is no getting of interrogating with the data that has been stored to FormData
. And, The official document mention the same.
So, instead of that why not fetch the length , by directly counting file numbers
var length=$(this).get(0).files.length
P.S : And you can get more detail though this question/answer.