javascript - axios 发送POST请求,上传文件
访问量: 709
refer to: https://stackoverflow.com/questions/43013858/how-to-post-a-file-from-a-form-with-axios
var formData = new FormData();
var imagefile = document.querySelector('#file');
formData.append("image", imagefile.files[0]);
axios.post('upload_file', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
})