报错
Current request is not a multipart request
@PostMapping(value = "/file/uploadchunk", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseResult uploadChunk(UploadReqDTO uploadReqDTO, @RequestParam("file") MultipartFile file) {
try {
byte[] bytes = file.getBytes();
String fileName = StringEncryptUtil.string2MD5(uploadReqDTO.getFileName()) + uploadReqDTO.getSuffix();
Path path = Paths.get(FileUtils.generatePath(filePath, uploadReqDTO.getFileCode(), fileName, uploadReqDTO.getPartNumber()));
//文件写入指定路径
Files.write(path, bytes);
return ResponseResult.ok();
} catch (IOException e) {
e.printStackTrace();
return ResponseResult.fail();
}
}
|