麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 網(wǎng)站 > 建站經(jīng)驗 > 正文

ECshop后臺編輯器fckeditor上傳文件按年月并非重命名的最新解決方法

2024-04-25 20:32:10
字體:
來源:轉載
供稿:網(wǎng)友

ecshop是一套非常好的網(wǎng)店系統(tǒng),fckeditor也是個不錯的html編輯器,常用于各種cms及商城系統(tǒng)實現(xiàn)在紡編輯html代碼,然后ecshop使用的fckeditor在上傳圖片和其它文件時是沒有按目錄存放的。

我們很多人都習慣上傳的文件按年和月這樣的日期存放這樣不至于上傳文件夾存放的內容太多太雜,影響系統(tǒng)的穩(wěn)定性,同時上傳的文件也沒有進行重命名,當我們上傳中文文件名的文件時有些時候會出錯,下面我們就來實現(xiàn):

一、ecshop的fckeditor上傳文件時按年和日存放,假如我們是2012年3月存放的,系統(tǒng)會自動建一個文件夾201207,方法

打開includes/fckeditor/editor/filemanager/connectors/php/config.php,找到:

修改前的代碼:

// Path to user files relative to the document root.

$Config['UserFilesPath'] = $root_path . IMAGE_DIR . '/upload/';

// Fill the following value it you prefer to specify the absolute path for the

// user files directory. Useful if you are using a virtual directory, symbolic

// link or alias. Examples: 'C://MySite//userfiles//' or '/root/mysite/userfiles/'.

// Attention: The above 'UserFilesPath' must point to the same directory.

$Config['UserFilesAbsolutePath'] = ROOT_PATH . IMAGE_DIR . '/upload/' ;

修改后的代碼:

// Path to user files relative to the document root.

$Config['UserFilesPath'] = $root_path . IMAGE_DIR . '/upload/'.date('Ym').'/';

// Fill the following value it you prefer to specify the absolute path for the

// user files directory. Useful if you are using a virtual directory, symbolic

// link or alias. Examples: 'C://MySite//userfiles//' or '/root/mysite/userfiles/'.

// Attention: The above 'UserFilesPath' must point to the same directory.

$Config['UserFilesAbsolutePath'] = ROOT_PATH . IMAGE_DIR . '/upload/'.date('Ym').'/';

然后保存,非常簡單,僅是在這兩行后面增加了 .date('Ym').'/'

二、ecshop的fckeditor上傳文件時自動重命名,方法:

找到文件:includes/fckeditor/editor/filemanager/connectors/php/io.php,找到

修改前的代碼:

// Do a cleanup of the file name to avoid possible problems

function SanitizeFileName( $sNewFileName )

{

global $Config ;

$sNewFileName = stripslashes( $sNewFileName ) ;

// Replace dots in the name with underscores (only one dot can be there... security issue).

if ( $Config['ForceSingleExtension'] )

$sNewFileName = preg_replace( '///.(?![^.]*$)/', '_', $sNewFileName ) ;

// Remove / / | : ? * " < >

$sNewFileName = preg_replace( '/////|///|//||//:|//?|//*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ) ;

return $sNewFileName ;

}

修改后的代碼:

// Do a cleanup of the file name to avoid possible problems

function SanitizeFileName( $sNewFileName )

{

global $Config ;

$sNewFileName = stripslashes( $sNewFileName ) ;

// Replace dots in the name with underscores (only one dot can be there... security issue).

if ( $Config['ForceSingleExtension'] )

$sNewFileName = preg_replace( '///.(?![^.]*$)/', '_', $sNewFileName ) ;

// Remove / / | : ? * " < >

//$sNewFileName = preg_replace( '/////|///|//||//:|//?|//*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ) ;

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

$sNewFileName = date('YmdHis').rand(0,999).'.'.$sExtension;

return $sNewFileName ;

}

就是把$sNewFileName = preg_replace( '///|//|/||/:|/?|/*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ) ;注釋掉,新增加:

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

$sNewFileName = date('YmdHis').rand(0,999).'.'.$sExtension;

保存后,在ecshop的后臺測試就會發(fā)現(xiàn)我們上傳的圖片按年月分目錄保存并自動重命名了!

經(jīng)測試ecshop V2.7.3 20120411版本還未失效的!

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 视频在线中文字幕 | 亚洲午夜国产 | 精品一区二区久久久久久按摩 | 天天干干| 欧美wwwsss9999 | 麻豆传传媒久久久爱 | 国产91久久久久 | 97精品国产高清在线看入口 | 久久撸视频 | 免费观看一级淫片 | 中文字幕国 | 黄色成人小视频 | 午夜视频在线看 | 国产高潮失禁喷水爽到抽搐视频 | 欧美精品18 | 久久99精品久久久久久久久久久久 | 91精品国产91久久久久久不卞 | 午色影院 | 久久久久久久久久亚洲精品 | 性欧美极品xxxx欧美一区二区 | 免费欧美一级视频 | 视频国产一区二区 | 久久免费视屏 | av在线官网| 午夜亚洲影院 | 国产一级性生活视频 | 免费黄色a | 性欧美大战久久久久久久免费观看 | 中文字幕伦乱 | 久久精品99久久久久久2456 | 精品中文字幕视频 | 日本精品久久久久 | 成人在线精品视频 | 国产免费大片视频 | 午夜在线观看视频网站 | 一级电影在线免费观看 | 亚洲精品一区二区三区大胸 | 成人做爰高潮片免费视频美国 | 国产一级性生活视频 | 久久草在线观看视频 | 中文字幕在线成人 |