|
|
@ -17,7 +17,10 @@ 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().replace("-", "").substring(0, 13) + fileName.substring(fileName.indexOf("."));
|
|
|
|
String newName = MyDateUtils.dateTime() + "_upd_" + UUID.randomUUID().toString().replace("-", "").substring(0, 13);
|
|
|
|
|
|
|
|
if (fileName.contains(".")) {
|
|
|
|
|
|
|
|
newName = newName + 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();
|
|
|
|