Failed to execute 'readAsText' on 'FileReader': parameter 1 is not of type 'Blob'
I am trying to read a user uploaded xml file in angular. Below is my code: Component.ts: convertFileToString(event){ this.uploadXML=event.target.files[0]; let fileReader = new FileReader(); fileReader.onload = (event) =>{this.finalUploadedXML=fileReader.result as String} fileReader.readAsText(this.uploadXML); console.log("The contents are:") console.log(this.finalUploadedXML); } index.html <input type="file" id="uploadInput" (change)="convertFileToString($event)" hidden> But when i run this code, it gives me the following error: Failed to execute 'readAsText' on 'FileReader': parameter 1 is no
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.