This commit is contained in:
pengjie 2023-12-07 16:20:26 +08:00
parent a432696105
commit f84cc49ba2

View File

@ -51,13 +51,31 @@ public class FileController {
.upload()); .upload());
} }
// /** /**
// * 上传文件到本地成功返回文件信息 * 上传文件到本地成功返回文件信息
// */ */
// @OperLog(operModul = "文件管理", operType = "文件上传", operDesc = "文件上传") // @OperLog(operModul = "文件管理", operType = "文件上传", operDesc = "文件上传")
// @ApiOperation(value = "文件上传", notes = "文件上传", httpMethod="POST") // @ApiOperation(value = "文件上传", notes = "文件上传", httpMethod="POST")
// @PostMapping("/upload") // @PostMapping("/upload")
// public Result<Map<String, Object>> upload(MultipartFile file) { // public Result<Map<String, Object>> upload(MultipartFile file) {
// String[] FILE_SUFFIX_SUPPORT ={".jsp",".php",".asp",".aspx"};
// // 校验文件是否为空
// if (file == null) {
// throw new RuntimeException("文件不能为空!");
// }
// //得到文件名
// String originalFilename = file.getOriginalFilename();
// // 校验文件后缀
// if (!originalFilename.contains(".")) {
// throw new RuntimeException("文件不能没有后缀!");
// }
// String suffix = originalFilename.substring(originalFilename.lastIndexOf('.'));
// for (String s : FILE_SUFFIX_SUPPORT) {
// //转换为小写比较Locale.ROOT为区域转换规则可不写
// if (s.equals(suffix.toLowerCase(Locale.ROOT))) {
// throw new RuntimeException("请上传正常的文件!");
// }
// }
// return Result.success(fileDetailService.upload(file)); // return Result.success(fileDetailService.upload(file));
// } // }