[Vuejs]-Uncaught DOMException: Failed to execute 'readAsDataURL' on 'FileReader'

1👍

Try this way

let fileReader = new FileReader();
fileReader.readAsDataURL(file);
fileReader.onload = function(fileLoad){
consoloe.log(fileReader.result);
}
👤Mridul

0👍

Had a similar problem, the below code worked for me fine.

fileReader(file: any) {
  const reader = new FileReader();
  reader.onloadend = () => {
    const formData = new FormData();
    const blobFile = new Blob([reader.result], { type: file.type });
    formData.append("file", blobFile, "filename");
    // POST formData call
  };
  reader.readAsArrayBuffer(file);
}
👤K.S

Leave a comment