我正在使用XMLHttpRequest在发布请求中将图片上传到我的服务器,图片
const http = new XMLHttpRequest();
http.upload.addEventListener("progress", function(e){}); // first attempt, not working...
http.addEventListener("progress", function(e){}); //second attempt, not working...
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Accept", "application/json, application/xml, text/plain, text/html, *.*");
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
http.send(params);
修改
这里提到的答案:How to get progress from XMLHttpRequest 不工作我的猜测是本地反应需要不同的解决方案。