How to read an XML file after an Angular upload?

Asked

Viewed 187 times

0

I am working with uploading XML in Angular 4. I would need to read the contents of this file and turn into a string.

Could someone help me ?

HTML

<input id="uploadXml" type="file"
 #uploadXml
 accept='text/xml'
 (change)="handleXmlFile(uploadXml)">
 

Javascript

handleXmlFile(_uploadXml){
   this.file = _uploadXml.files[0]; 
}
  • 1

    Try File API, as in this example I did in pure JS: https://answall.com/a/117499/3635, it is not complicated to convert to Typescript

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.