console
$("#exampleInputFile").on("change", FileChange)
function FileChange(e) {
var file = e.target.files[0];
var n = new FileReader;
n.onerror = function(e) {
error = "文件读取错误";
}
n.onload = function(t) {
tips = "正在上传...";
console.log("Start");
console.log(t.currentTarget.result);
console.log(file);
console.log("End");
}
n.onloadend = function(e) {}
n.onloadstart = function(e) {}
n.onprogress = function(evt) {
if (evt.lengthComputable) {
var percentLoaded = Math.round((evt.loaded / evt.total)* 100);
console.log(percentLoaded + '%');console.log(evt);
}
}
n.readAsArrayBuffer(file);
}
<input type="file" name="FileData" id="exampleInputFile">
<p class="help-block">选择要上传的文件</p>