0
Good afternoon.
I’m having this error - this.fileLoad.then is not a Function, could someone please explain to me why this is happening?
fileLoad(){
return new Promise((resolve, reject) =>{
let fileReader = new FileReader();
let fieldFile = [...this.formID].find(element =>{
if(element.type === "file"){
return element.files;
}
});
fileReader.onload = () =>{
fileReader.result;
resolve(fileReader);
}
fileReader.onerror = () =>{
reject("erro");
}
fileReader.readAsDataURL(fieldFile.files[0]);
}
)};
this.fileLoad.then(
(content)=>{
console.log(content);
},
(e)=>{
console.log(e);
})
Uncaught Typeerror: this.fileLoad.then is not a Function at userController.adduser (userController.js:76) at userController.loadFiles (userController.js:57) At Htmldocument.document.addeventlistener.Event (userController.js:20)
Have you tried without the this?
– LeAndrade
Thanks found the error, forgot to set the call to a Function this.fileLoad.then - this.fileLoad.then();
– user70904
Bruno, if you can, mark the question as answered friend.
– Gustavo Santos