ckeditor和ckfinder结合使用时问题的解决办法
2015-06-26 20:02
393 查看
ckeditor是很流行的的文本编辑器,ckfinder是它的补充,为ckeditor提供图片、flash上传功能,在使用它们的过程中,遇到一些问题,记录下来。
1、当上传图片名称是中文时,上传失败。解决办法:在tomcat的配置文件server.xml中,在Connector组件处,加上 URIEncoding="utf-8"。
2、重复上传同一文件,报错,解决办法,修改FileUploadCommand.java类,在execute方法开始出加上errorCode=0;如下所示:
阅读源代码可以发现,当文件存在时,系统会给这个赋值201,导致出错。
1、当上传图片名称是中文时,上传失败。解决办法:在tomcat的配置文件server.xml中,在Connector组件处,加上 URIEncoding="utf-8"。
2、重复上传同一文件,报错,解决办法,修改FileUploadCommand.java类,在execute方法开始出加上errorCode=0;如下所示:
@Override public void execute(final OutputStream out) throws ConnectorException { if (configuration.isDebugMode() && this.exception != null) { throw new ConnectorException(this.errorCode, this.exception); } try { errorCode=0; String errorMsg = (this.errorCode == 0) ? "" : ErrorUtils.getInstance().getErrorMsgByLangAndCode(this.langCode, this.errorCode, this.configuration); errorMsg = errorMsg.replaceAll("%1", Matcher.quoteReplacement(this.newFileName)); String path = ""; if (!uploaded) { this.newFileName = ""; this.currentFolder = ""; } else { path = configuration.getTypes().get(type).getUrl() + this.currentFolder; } if (this.responseType != null && this.responseType.equals("txt")) { out.write((this.newFileName + "|" + errorMsg).getBytes("UTF-8")); } else { out.write("<script type=\"text/javascript\">".getBytes("UTF-8")); if (checkFuncNum()) { handleOnUploadCompleteCallFuncResponse(out, errorMsg, path); } else { handleOnUploadCompleteResponse(out, errorMsg); } out.write("</script>".getBytes("UTF-8")); } } catch (IOException e) { throw new ConnectorException( Constants.Errors.CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED, e); } }
阅读源代码可以发现,当文件存在时,系统会给这个赋值201,导致出错。
相关文章推荐
- 欢迎使用CSDN-markdown编辑器
- 用场景来规划测试工作
- GridView实现超链接列和图片列,跳转页面并传递参数
- RNote__Reshape2
- Tomcat部署web项目
- ios周刊 第四期
- C++操作符重载
- Web worker耗尽原因定位
- 作业5 四则运算 测试与封装
- 第九章
- iOS周刊 第三期
- nginx常用负载方式
- zTree 树形组件结合bootstrap的使用
- SQL Server 2008 Windows身份验证改为混合模式身份验证
- MFC,VC++计算器小程序
- Java知多少(104)网络编程之统一资源定位符URL
- java、oracle、jsp中string与date与sql.date的转换
- PCIE
- 插件开发-UI插件开发
- 素数判断算法