lyhzzz преди 3 години
родител
ревизия
2aed635480
променени са 1 файла, в които са добавени 27 реда и са изтрити 3 реда
  1. 27 3
      4dkankan-utils-fyun/src/main/java/com/fdkankan/fyun/oss/UploadToOssUtil.java

+ 27 - 3
4dkankan-utils-fyun/src/main/java/com/fdkankan/fyun/oss/UploadToOssUtil.java

@@ -133,7 +133,15 @@ public class UploadToOssUtil {
 			}
 		}
 		if("local".equals(type)){
-			 new File(localPath + key1);
+			try {
+				File file = new File(localPath + key1);
+				if (!file.getParentFile().exists()) {
+					file.getParentFile().mkdirs();
+				}
+				file.createNewFile();
+			}catch (Exception e){
+				e.printStackTrace();
+			}
 		}
 	}
 
@@ -173,7 +181,15 @@ public class UploadToOssUtil {
 			}
 		}
 		if("local".equals(type)){
-			new File(localPath + key1);
+			try {
+				File file = new File(localPath + key1);
+				if (!file.getParentFile().exists()) {
+					file.getParentFile().mkdirs();
+				}
+				file.createNewFile();
+			}catch (Exception e){
+				e.printStackTrace();
+			}
 		}
 	}
 
@@ -213,7 +229,15 @@ public class UploadToOssUtil {
 		}
 
 		if("local".equals(type)){
-			new File(localPath + key1);
+			try {
+				File file = new File(localPath + key1);
+				if (!file.getParentFile().exists()) {
+					file.getParentFile().mkdirs();
+				}
+				file.createNewFile();
+			}catch (Exception e){
+				e.printStackTrace();
+			}
 		}
 	}