I am using vue cli v.2.5.2
Would like to read the contents of a text file.
The form,
<input type="file" @change="onFileChange()">
calls the method onFileChange()
onFileChange: function(e){
this.someData = e.target.files[0].result;
console.log(this.someData);
},
someData is declared in data,
data(){
return {
someData: ''
}
},
There are many examples online but they nearly all involve uploading an image file. I am trying to read an uploaded text file.
Would FileReader() be useful here?