我正在尝试实现取消功能,以在上传视频时取消视频的文件上传。这就是视频上传时我的前端的样子
这是我使用 axios 发送请求的代码:
export function processPost (body, callback, errorUpdate) {
// config for post
var config = {
timeout: 300000,
headers: { 'content-type': 'multipart/form-data' }
}
// url for server endpoint
var url = 'http://localhost:5000/uploader'
// actual post
axios
.post(url, body, config)
.then(callback)
.catch(function (error) {
// Non 200 Response
if (error.response) {
errorUpdate('non 200 response from server')
// Request made but no response received
} else if (error.request) {
errorUpdate('no response from server')
// something else happened
} …Run Code Online (Sandbox Code Playgroud)