用js给出一个上传文件时不用刷新页面的方案 <input id="upload" type="file"/> <button id="upload-btn">upload</button> document.getElementById('upload-btn').onclick = function(){ var oInput = document.getElementById('upload'); var file = oInput.files[0]; //选取文件 var formData = new FormData(); //