fix: 文件名缩短

dev
huangfeng 10 months ago
parent 23ebee8be2
commit 4b1637594c

@ -17,7 +17,7 @@ public class UploadUtils {
*/ */
public static String upload(MultipartFile file, String path) throws IOException { public static String upload(MultipartFile file, String path) throws IOException {
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
String newName = MyDateUtils.dateTime() + "_upd_" + UUID.randomUUID().toString() + fileName.substring(fileName.indexOf(".")); String newName = MyDateUtils.dateTime() + "_upd_" + UUID.randomUUID().toString().replace("-", "").substring(0, 13) + fileName.substring(fileName.indexOf("."));
File saveFile = new File(path); File saveFile = new File(path);
if (!saveFile.exists()) { if (!saveFile.exists()) {
boolean mkdirs = saveFile.mkdirs(); boolean mkdirs = saveFile.mkdirs();

Loading…
Cancel
Save