要将文件上传到服务器,您需要使用
FormData
例如
var formData = new FormData(); formData.append("filename", file); xhr.send(formData);