Home > php教程 > php手册 > body text

joomla jce editor 解决上传中文名文件失败问题

WBOY
Release: 2016-06-13 11:49:01
Original
1047 people have browsed it

不论是JCE还是CKEDITOR,都没解决中文名文件的问题,要么上传失败,要么传上去了中文名不能被web访问。相比之下,JCE更加人性化,比如文件上传后默认被选中,不需用户在那么小的弹出窗口去上下翻搜寻刚刚上传的文件。研究了下JCE的源码,改掉保存文件名的方式,使用纯数字来作为文件名。

到joomla安装的目录,找到components/com_jce/editor/extensions/browser/file.php,修改 1017 - 1020 行:

复制代码 代码如下:


// strip extension
$name = WFUtility::stripExtension($name);
// make file name 'web safe'
$name = WFUtility::makeSafe($name, $this->get('websafe_mode', 'utf-8'));


改成

复制代码 代码如下:


$name = date('Ymd-His-', time()).rand(999);


我的joomla版本是1.5, JCE版本 2.1.3,不同版本修改的位置可能稍有差别。
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template