百度编辑器多图上传返回图片绝对路径有关问题
百度编辑器多图上传返回图片绝对路径问题
private String getPath ( File file ) {
//String path = file.getAbsolutePath();
//输出的路径为:\Project\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\qw\ueditor\jsp\upload\image\20150809\1439097577967024082.jpg
String path = PathFormat.format(file.getAbsolutePath());
//输出的路径为:/Project/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/qw/ueditor/jsp/upload/image/20150809/1439097577967024082.jpg
return path.replace(this.rootPath, "" );
}
在官方下载jsp版本的百度编辑器,修改源码然后打包成jar即可,
修改方法如下:
修改FileManager.java文件中的getPath 方法为private String getPath ( File file ) {
//String path = file.getAbsolutePath();
//输出的路径为:\Project\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\qw\ueditor\jsp\upload\image\20150809\1439097577967024082.jpg
String path = PathFormat.format(file.getAbsolutePath());
//输出的路径为:/Project/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/qw/ueditor/jsp/upload/image/20150809/1439097577967024082.jpg
return path.replace(this.rootPath, "" );
}
版权声明:本文为博主原创文章,未经博主允许不得转载。