作者:qweqwe | 来源:互联网 | 2023-09-01 18:03
1.我用axios上传200M的视频出现了错误
1 2 3 4 5 6 7 8
| Request Headers
Provisional headers are shown
Accept:application/json, text/plain, */*
Content-Type:multipart/form-data; boundary=----WebKitFormBoundary8Q6eAZowYX2saNAy
Origin:http://a.com
Referer:http://a.com/self_class/create
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36
X-XSRF-TOKEN:eyJpdiI6ImFsVzJFWDdtTm5YTU5cL0ZtRTRnVytBPT0iLCJ2YWx1ZSI6IjFKWGp3VEZzZytvRUZQQ1p6WlVlRXN1SEhaYnNYSFhmdVhxeDNsU1JEOEw3Sjk2K3hwazdtOWFnVkxkc1FtV085Z3JsQU5qcG9cL0ZIczZ2bGJ1ZG12QT09IiwibWFjIjoiNmE4MDJlYjlmY2IyN2Y0YjhhNDE1MTcwNmUwNDBhYjBiZDM4MjJkMTI5MDI1MTI1ZTliODQ5OGIwYmFlMDRkMSJ9 |
2.一开始我认为是php.ini配置的问题,我修改了上传的一些现在,还是不行,但是当我用form表单上传的时候是可以的,所以我认为我的php配置没有问题
3.下面是我axios代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| let fd = new FormData();
let data = this.sendData;
$.each(data, function (index, item) {
fd.append(index, item);
});
let face_img = $('#face_img')[0].files[0];
if ($('#right_box').has('#self_content').length) {
var cOntent= $('#self_content')[0].files[0];
}
let html_cOntent= this.sendData.html_content;
if (!content) {
cOntent= html_content;
}
console.log(content);
fd.append('face_img', face_img);
fd.append('content', content);
let cOnfig= {
headers: {'Content-Type': 'multipart/x-www-form-urlencoded'},
onUploadProgress: function (e) {
console.log(e);
},
timeout:999999
}
axios.post('/self_class/add_self', fd, config).then(function (res) {
console.log(res);
}); |