Struggling to retrieve a string in a reader.onloadend but it's constantly returning my entire function. Here is the function I'm using:
uploadFile() {
let vm = this;
var file = vm.$refs["testeLogo"].files[0];
var reader = new FileReader();
reader.onloadend = function() {
console.log(reader.result); // returns me a string base64
document.querySelector("#supe").setAttribute("src", this.imagem);
return reader.result;
};
reader.readAsDataURL(file);
}
Looking for advice on how to successfully fetch and return the string value, as it currently seems to be returning my function instead of the expected reader.result displayed in the console.log.