Commit 6a15012d authored by 刘可心's avatar 刘可心

帮助中心文件下载问题

parent 5b1e94cb
...@@ -39,7 +39,13 @@ public class HelperService { ...@@ -39,7 +39,13 @@ public class HelperService {
int i = template.getName().lastIndexOf("."); int i = template.getName().lastIndexOf(".");
String ext = formerName.substring(i); String ext = formerName.substring(i);
String fileName = File.separator + "helper" + File.separator + UUID.randomUUID() + "." + ext; String fileName = File.separator + "helper" + File.separator + UUID.randomUUID() + "." + ext;
template.renameTo(new File(PathKit.getWebRootPath() + fileName)); /**LiuKexin 20210315 文件夹不存在创建 start */
File newFile = new File(PathKit.getWebRootPath() + fileName);
if (!newFile.getParentFile().exists()) {
newFile.getParentFile().mkdirs();
}
/**LiuKexin 20210315 文件夹不存在创建 start */
template.renameTo(newFile);
Helper helper = new Helper(); Helper helper = new Helper();
helper.setId(Db.findFirst(Db.getSql("getHelperId")).getInt("id")); helper.setId(Db.findFirst(Db.getSql("getHelperId")).getInt("id"));
helper.setName(name); helper.setName(name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment