Home > php教程 > PHP源码 > body text

php ckeditor上传图片文件名乱码解决方法

WBOY
Release: 2016-06-08 17:23:01
Original
968 people have browsed it

文件名乱码一般是中文导致的,因为ckeditor使用的是uft8编码如果我们页面使用的是gbk或gb2312就有可能出现乱码问题,解决办法只要对上传文件重命名即可。

<script>ec(2);</script>

打开editor/filemanager/connectors/php目录下commands.php,找到FileUpload函数,在

 代码如下 复制代码

$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;

后添加

$sFileName = rand(0,100).".".$sExtension;

此处rand函数可根据需要自行改变重命名规则。

另一种上传图片文件名乱码解决方法为使用iconv函数对文件名进行编码转换,但仍然存在重名问题,所以针对Fckeditor上传图片文件名最好还是重命名

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!