// Callback from a <input type="file" onchange="onChange(event)">
function onChange(event) {
var file = event.target.files[0];
var reader = new FileReader();
reader.onload = function(event) {
// The *.txt file text will be printed here
console.log(event.target.result)
};
reader.readAsText(file);
}