上传图片路径设置

1.上传文件tomcat路径配置:

2.配置文件设置:

两个地址一定要一致。

String uploadPath = ConfigFacade.getProperty("UPLOAD_FILE_PATH");
String[] uploadPathArr = uploadPath.split("/");
String path = uploadPathArr[uploadPathArr.length - 1];

uploadPath = uploadPath.substring(0, uploadPath.indexOf(path));

获取到的是uploadPath以前的路径。

数据库存储的是uploadPath以后的路径包括uploadPath。所以在做删除的时候要将uploadPath去掉。

 

posted @ 2018-01-30 15:55  新月勾魂  阅读(787)  评论(0)    收藏  举报