|
@@ -172,6 +172,8 @@ public class FileUtils {
|
|
|
HashMap<String, String> result = new HashMap<>();
|
|
|
result.put("fileName", fileName);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
String fileType = getFileType(fileName);
|
|
|
String dirType = "image/";
|
|
|
if (fileType.equals("doc")) {
|
|
@@ -179,6 +181,7 @@ public class FileUtils {
|
|
|
}
|
|
|
|
|
|
String suffix = StringUtils.substringAfterLast(fileName, ".");
|
|
|
+ result.put("suffix", suffix);
|
|
|
String newName = time + "." +suffix;
|
|
|
savePath = savePath + dirType + newName;
|
|
|
|
|
@@ -205,6 +208,12 @@ public class FileUtils {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testsss(){
|
|
|
+ System.out.println(StringUtils.substringAfterLast("xxxx.doc", "."));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 文件上传,用来上传指定文档,应用程序需要不同的文件,特意针对他们设计
|
|
|
* @param file
|
|
@@ -234,6 +243,7 @@ public class FileUtils {
|
|
|
String dirType = "doc/" + code + "/";
|
|
|
|
|
|
String suffix = StringUtils.substringAfterLast(fileName, ".");
|
|
|
+ result.put("suffix", suffix);
|
|
|
String newName = type + "." +suffix;
|
|
|
savePath = savePath + dirType + newName;
|
|
|
|