fix(upload): 修复文件上传时的请求头配置问题
- 在 storage API 调用中添加 multipart/form-data 请求头
- 在 upload 组件中为文件上传请求添加正确的 Content-Type 头
- 确保文件上传时使用正确的表单数据格式
- 解决因请求头缺失导致的上传失败问题
| | |
| | | return requestClient.post<SystemStorageApi.StorageBlob[]>( |
| | | '/system/storage-blob/upload', |
| | | formData, |
| | | { headers: { 'Content-Type': 'multipart/form-data' } }, |
| | | ); |
| | | } |
| | | |
| | |
| | | formData.append('files', file); |
| | | const blobs = await requestClient.post('/system/storage-blob/upload', formData, { |
| | | onUploadProgress, |
| | | headers: { 'Content-Type': 'multipart/form-data' }, |
| | | }); |
| | | const blob = Array.isArray(blobs) ? blobs[0] : blobs; |
| | | return blob ? { url: blob.url || blob.previewURL, name: blob.name, id: blob.id } : {}; |