|
|
@@ -48,13 +48,14 @@ public class StorageManager {
|
|
|
|
|
|
public static State saveFileByInputStream(InputStream is, String path,
|
|
|
long maxSize) {
|
|
|
+ System.out.println("saveFileByInputStream");
|
|
|
BaseState validateState = isUserUpFileType(is,path.substring(path.lastIndexOf(".")));
|
|
|
if(!validateState.isSuccess()) return validateState;
|
|
|
State state = new BaseState(false, AppInfo.IO_ERROR);
|
|
|
File tmpFile = validateState.getTmpFile();
|
|
|
if(tmpFile!=null){
|
|
|
state = saveTmpFile(tmpFile, path);
|
|
|
- tmpFile.delete();
|
|
|
+ deleteTmpFile(tmpFile);
|
|
|
return state;
|
|
|
}
|
|
|
return state;
|
|
|
@@ -67,6 +68,7 @@ public class StorageManager {
|
|
|
File tmpFile = validateState.getTmpFile();
|
|
|
if(tmpFile!=null){
|
|
|
state = saveTmpFile(tmpFile, path);
|
|
|
+ deleteTmpFile(tmpFile);
|
|
|
return state;
|
|
|
}
|
|
|
return state;
|
|
|
@@ -138,4 +140,12 @@ public class StorageManager {
|
|
|
}
|
|
|
return new BaseState(true, AppInfo.SUCCESS, tmpFile);
|
|
|
}
|
|
|
+
|
|
|
+ private static void deleteTmpFile(File tmpFile) {
|
|
|
+ try{
|
|
|
+ tmpFile.delete();
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|