浏览代码

上传文件添加前缀分隔符

caixiaofeng 10 月之前
父节点
当前提交
d8a05de585
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      flow-file/flow-file-biz/src/main/java/com/flow/utils/FileUtil.java

+ 2 - 2
flow-file/flow-file-biz/src/main/java/com/flow/utils/FileUtil.java

@@ -18,7 +18,7 @@ public class FileUtil {
         String fileName = file.getOriginalFilename();
         try {
             // 路径
-            String path = filePath +format +fileName;
+            String path = String.format("%s%s_%s", filePath, format, fileName);
             File dest = new File(path).getCanonicalFile();
             // 检测是否存在目录
             if (!dest.getParentFile().exists()) {
@@ -36,7 +36,7 @@ public class FileUtil {
         return null;
     }
 
-    public static void del(String filePath){
+    public static void del(String filePath) {
         if (filePath != null && filePath.length() > 0) {
             File file = new File(filePath);
             if (file.exists()) {