更改文件名

This commit is contained in:
seesaw
2024-09-27 11:40:34 +08:00
parent dd6da99a5d
commit 35f549ef70

View File

@ -96,7 +96,7 @@ public class FaceController {
uploadDir.mkdir();
}
String suffix = FileNameUtil.getSuffix(file.getOriginalFilename());
String imagePath = uploadDirPath + userId + "." + suffix;
String imagePath = uploadDirPath + IdUtil.getSnowflakeNextIdStr() + "." + suffix;
// 获取文件字节并保存到指定路径
byte[] bytes = file.getBytes();
Path path = Paths.get(imagePath);