var input = document.createElement('input');
input.setAttribute('type', 'file');
input.onchange = function() {
var file = input.files[0];
var reader = new FileReader();
reader.readAsText(file);
reader.onload = function() {
txt = reader.result;
console.log(txt);
};
}
input.click();
txt