主要原因是fck中的編(utf-8)碼和本地的編碼(gbk)環緊不一致導致的,修改如下5個檔案可以解決
更改FileUpLoad函數 ckeditor/" target="_blank">fckeditoreditorfilemanagerconnectorsphpcommands.php
在檔案中找到以下代碼:
代碼如下 |
複製代碼 |
// Get the extension. $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; $sExtension = strtolower( $sExtension ) ; |
在其後加上一句:
代碼如下 |
複製代碼 |
$sFileName = strtotime('now').'.'.$sExtension; |
這樣檔案名稱就是 目前時間戳+尾碼名了。既解決了中文亂碼,也解決了檔案重名
另一種解決辦法,保留中文名
檔案4:fckeditoreditorfilemanagerconnectorsphpcommands.php
找到
代碼如下 |
複製代碼 |
function FileUpload( $resourceType, $currentFolder, $sCommand ){ 。。。 找到 //move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; move_uploaded_file( $oFile['tmp_name'], iconv("utf-8","gbk",$sFilePath)); } |
對檔案名稱$sFilePath轉碼。
檔案5:fckeditoreditorfilemanagerconnectorsphputil.php
找到
代碼如下 |
複製代碼 |
function ConvertToXmlAttribute( $value ){ 。。。 找到 //return ( utf8_encode( htmlspecialchars( $value ) ) ) ; return iconv("GBK", "UTF-8", htmlspecialchars( $value )); } |
對內容進行轉碼。