fix:本地文件上传win系统生成路径问题
This commit is contained in:
@@ -43,15 +43,15 @@ public class LocalFileUploadStrategy implements FileUploadStrategy {
|
||||
String date = DateUtil.format(new Date(),
|
||||
DatePattern.PURE_DATE_PATTERN);
|
||||
String absoluteUploadFolder = localFileProperties.getAbsoluteUploadFolder();
|
||||
String fullPath = absoluteUploadFolder + File.separator + date;
|
||||
String fullPath = absoluteUploadFolder + "/" + date;
|
||||
FileUtil.mkdir(fullPath);
|
||||
for (MultipartFile file : files) {
|
||||
// 保存文件
|
||||
String fileName = StrUtil.uuid().replaceAll("-", "") + getExtensionName(
|
||||
Objects.requireNonNull(file.getOriginalFilename()));
|
||||
file.transferTo(new File(fullPath
|
||||
+ File.separator + fileName));
|
||||
fileUrls.add(baseUrl + File.separator + date + File.separator + fileName);
|
||||
+ "/" + fileName));
|
||||
fileUrls.add(baseUrl + "/" + date + "/" + fileName);
|
||||
}
|
||||
if (fileUrls.size() == 1) {
|
||||
return fileUrls.get(0);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
✨🌈✨[cool-admin-java-plus](https://gitee.com/hlc4417/cool-admin-java-plus)✨🌈✨
|
||||
______ ___ ___ _____ _ ______ ____ ____ _____ ____ _____
|
||||
.' ___ | .' `. .' `.|_ _| V7.x / \ |_ _ `.|_ \ / _||_ _||_ \|_ _|
|
||||
/ .' \_|/ .-. \/ .-. \ | | ______ / _ \ | | `. \ | \/ | | | | \ | |
|
||||
|
||||
Reference in New Issue
Block a user