支持blob

--听一首歌,回忆一段往事
This commit is contained in:
meng 2018-11-25 13:31:35 +08:00
parent a1b89a6b44
commit 37bf0d609b
1 changed files with 13 additions and 5 deletions

View File

@ -68,14 +68,22 @@ public class UploadUtil {
public LoadType fileNameStyle(MultipartFile multipartFile) { public LoadType fileNameStyle(MultipartFile multipartFile) {
String curr = multipartFile.getOriginalFilename(); String curr = multipartFile.getOriginalFilename();
int suffixLen = curr.lastIndexOf("."); int suffixLen = curr.lastIndexOf(".");
if (suffixLen == -1) { boolean flag=false;
int index=-1;
if("blob".equals(curr)){
flag=true;
index=0;
curr=UUID.randomUUID() + ".png";
} else if (suffixLen == -1) {
throw new MyException("文件获取异常"); throw new MyException("文件获取异常");
} }
if(!flag){
String suffix = curr.substring(suffixLen, curr.length()); String suffix = curr.substring(suffixLen, curr.length());
int index = Arrays.binarySearch(IMAGE_SUFFIX.split(","), index = Arrays.binarySearch(IMAGE_SUFFIX.split(","),
suffix.replace(".", "")); suffix.replace(".", ""));
curr = UUID.randomUUID() + suffix; curr = UUID.randomUUID() + suffix;
}
LoadType loadType = new LoadType(); LoadType loadType = new LoadType();
loadType.setFileName(curr); loadType.setFileName(curr);
//image 情况 //image 情况