Commit 1a6681e7 authored by daniel's avatar daniel

Merge remote-tracking branch 'origin/master'

parents d8e1cb4a 659f419c
......@@ -106,7 +106,17 @@ public class CommonController {
@ApiOperation(value = "参赛声明上传")
public Result<?> uploadClaimer(@RequestPart @RequestParam("file") MultipartFile file,@RequestParam(value = "gCmptId") Integer gCmptId) {
try {
// 检查文件大小是否超过1MB
long maxFileSize = 1024 * 1024; // 1MB
if (file.getSize() > maxFileSize) {
return Result.fail().setMsg("上传文件大小不能超过1MB");
}
String originalFilename = file.getOriginalFilename();
if (originalFilename == null || originalFilename.isEmpty()) {
return Result.fail().setMsg("文件名不能为空");
}
assert originalFilename != null;
// 检查文件名中是否包含点号
int lastIndex = originalFilename.lastIndexOf(".");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment