|
|
@ -2,6 +2,7 @@ package com.shxy.xymanager_common.util;
|
|
|
|
|
|
|
|
|
|
|
|
import com.shxy.xymanager_common.util.spring.SpringUtils;
|
|
|
|
import com.shxy.xymanager_common.util.spring.SpringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
|
|
|
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
|
|
|
import org.springframework.context.MessageSource;
|
|
|
|
import org.springframework.context.MessageSource;
|
|
|
|
import org.springframework.context.i18n.LocaleContextHolder;
|
|
|
|
import org.springframework.context.i18n.LocaleContextHolder;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
@ -24,7 +25,6 @@ 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 = UUID.randomUUID().toString()+fileName.substring(fileName.indexOf("."));
|
|
|
|
String newName = UUID.randomUUID().toString()+fileName.substring(fileName.indexOf("."));
|
|
|
|
|
|
|
|
|
|
|
|
File saveFile = new File(path+newName);
|
|
|
|
File saveFile = new File(path+newName);
|
|
|
|
if(!saveFile.getParentFile().exists()){
|
|
|
|
if(!saveFile.getParentFile().exists()){
|
|
|
|
saveFile.getParentFile().mkdirs();
|
|
|
|
saveFile.getParentFile().mkdirs();
|
|
|
|