Commit 3d21f99402030ffa48f4476175372004fc377424
1 parent
4c5354c1c1
Exists in
master
update
Showing 1 changed file with 3 additions and 1 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java
View file @
3d21f99
... | ... | @@ -57,7 +57,9 @@ |
57 | 57 | String furl = ""; |
58 | 58 | if (Objects.nonNull(imgFile)) { |
59 | 59 | try { |
60 | - File file = new File(uploadPath + File.separator + System.currentTimeMillis() + imgFile.getOriginalFilename()); | |
60 | + String[] orginaF=imgFile.getOriginalFilename().split("\\."); | |
61 | + | |
62 | + File file = new File(uploadPath + File.separator + System.currentTimeMillis() +"."+ orginaF[orginaF.length-1]); | |
61 | 63 | imgFile.transferTo(file); |
62 | 64 | furl = file.getAbsolutePath(); |
63 | 65 | log.info("上传文件:" + furl); |