1、将文件分片对象Blob转换为formData
const formData = new FormData();
formData.append('file', chunkItem.chunk.file); // 假设服务器期望的字段名为 'file'
temp(uploadUrl, formData)
2、.js函数如下:
export const temp= (uploadUrl,formData) => {
return request({
url: ' ',
method: 'post',
params: {
uploadUrl,
},
data: formData
})
}
3.后端接口:
@PostMapping(value = "/temp")
public HttpResponse uploadChunkList(@RequestParam String uploadUrl, @RequestParam MultipartFile file) {
}