您好,有一个axios请求,您可以看下对您是否有帮助:
- const fd = new FormData();
- fd.append('file', blob);
- fd.append('fileName', fileName);
- axios({
- method: "post",
- url: "spread/saveFile",
- data: fd,
- headers: {
- cache: false,
- "Content-Type": "application/x-www-form-urlencoded",
- processData: false,
- "Access-Control-Allow-Origin": "*",
- crossDomain: true
- },
- withCredentials: true
- }).then(
- response => {
- if (response.data.isSuccess == 1) {
- alert("上传成功!保存位置:" + response.data.localPath);
- }
- },
- err => {
- alert(err.errorMessage);
- }
- );
复制代码
|