|
@@ -315,13 +315,11 @@ const submitUpload = async ()=>{
|
|
|
|
|
|
// 创建 FormData 对象
|
|
// 创建 FormData 对象
|
|
const formData = new FormData()
|
|
const formData = new FormData()
|
|
- // 1. 添加文件数组(JSON格式)
|
|
|
|
- formData.append('files', JSON.stringify(
|
|
|
|
- filesWithSort.map(item => ({
|
|
|
|
- sort: item.sort,
|
|
|
|
- file:item.file,
|
|
|
|
- })),
|
|
|
|
- ))
|
|
|
|
|
|
+
|
|
|
|
+ // 2. 单独添加每个文件(保持文件二进制数据)
|
|
|
|
+ filesWithSort.forEach((item, index) => {
|
|
|
|
+ formData.append(`file_${index}`, item.file, item.file.name)
|
|
|
|
+ })
|
|
|
|
|
|
// 添加其他必要的上传参数
|
|
// 添加其他必要的上传参数
|
|
formData.append('classify', uploadData.value.classify)
|
|
formData.append('classify', uploadData.value.classify)
|