I have a requirement to retrieve an xls file and convert its content into json format. Currently, I am able to achieve this by specifying the file path directly in my code like below:
var url = "D:/ionic/Docs/Test.xlsx";
However, I now need to allow users to select the file using an HTML input tag and then assign the selected file path to the var url
. How can this be accomplished?
Home.html
<input type="file" accept="all/*" [(ngModel)]="getfile" (change)="onFileSelected($event)" id="fileInput"/>
Home.ts
code:
onFileSelected()
{
var url = //what do I do here ;