fix: 上传 FormData 交由 axios 自动设置 multipart 边界
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -60,9 +60,7 @@ async function doUpload({ file, onFinish, onError }: UploadCustomRequestOptions)
|
|||||||
try {
|
try {
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('file', file.file as File);
|
fd.append('file', file.file as File);
|
||||||
const res: any = await post(`/upload?type=${props.type}`, fd, {
|
const res: any = await post(`/upload?type=${props.type}`, fd);
|
||||||
headers: { 'Content-Type': 'multipart/form-data' },
|
|
||||||
});
|
|
||||||
emit('update:modelValue', [
|
emit('update:modelValue', [
|
||||||
...(props.modelValue || []),
|
...(props.modelValue || []),
|
||||||
{ key: res.key, url: res.url, name: res.name, type: props.type },
|
{ key: res.key, url: res.url, name: res.name, type: props.type },
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ async function doImport({ file, onFinish, onError }: UploadCustomRequestOptions)
|
|||||||
try {
|
try {
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('file', file.file as File);
|
fd.append('file', file.file as File);
|
||||||
const res: any = await post('/outbound/import', fd, { headers: { 'Content-Type': 'multipart/form-data' } });
|
const res: any = await post('/outbound/import', fd);
|
||||||
const jobId = res.jobId;
|
const jobId = res.jobId;
|
||||||
let job: any = null;
|
let job: any = null;
|
||||||
for (let i = 0; i < 40; i++) {
|
for (let i = 0; i < 40; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user