XHR abort doesn't stop file uploading

后端 未结 3 876
鱼传尺愫
鱼传尺愫 2020-12-20 06:14

I\'ve made an XHR-based file uploader with progressbar, and I would like to add a feature to cancel the upload before it fully uploaded. The simlified code (runs after DOM r

3条回答
  •  天涯浪人
    2020-12-20 06:55

    Ok, I noticed that the event name is onabort. With the xhr.abort = ... line I overwrote the abort function. So the solution:

    xhr.onabort = function(){...};

    or

    xhr.addEventListener("abort", function(){...});

提交回复
热议问题