📅  最后修改于: 2022-03-11 15:03:58.393000             🧑  作者: Mango
//get file object
var file = document.getElementById('myFile').files[0];
if (file) {
// create reader
var reader = new FileReader();
reader.readAsText(file);
reader.onload = function(e) {
// browser completed reading file - display it
alert(e.target.result);
};
}