x-file-storage
x-file-storage copied to clipboard
上传的文件 MD5 都一样
调用方式如下:
@Operation(summary = "上传文件", description = "上传文件")
@PostMapping(value = "/file/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public Result<InfraFileUploadResponse> upload(@Parameter(description = "文件", required = true)
@NotNull(message = "上传文件不能为空")
@RequestParam MultipartFile file) {
String date = DateUtil.format(LocalDateTime.now(), "yyyy/MM/dd");
String path = String.format(PATH_FORMAT, date);
FileInfo fileInfo = this.fileStorageService.of(file)
.setHashCalculatorMd5()
.setPath(path)
.upload();
InfraFileUploadResponse data = InfraFileUploadResponse.from(fileInfo);
log.info("MD5:{}", fileInfo.getHashInfo().getMd5());
return Result.success("上传文件成功", data);
}
上传了几个不同的文件