ckFinder編輯器上傳圖片如何進(jìn)行從新按照時(shí)間命名呢?
ASP版本方法:
代碼如下:
在ckfinder/core/connector/asp/CommandHandler/FileUpload.asp中找到代
碼:
If (sFileName <> sUnsafeFileName) Then iErrorNumber =
CKFINDER_CONNECTOR_ERROR_UPLOADED_INVALID_NAME_RENAMED
sExtension = oCKFinder_Factory.UtilsFileSystem.GetExtension(
sFileName )
在其下面加上代碼:
sFileName=Year(Date())&Right("0"&Month(Date()),2)&Right("0"&Day
(Date()),2)&Clng(Timer()*1000)&"."&sExtension就可以了
PHP版本方法:
修改ckfinder\core\connector\php\php5\CommandHandler\FileUpload.php
找到以下代碼
if($sFileName!= $sUnsafeFileName) {
$iErrorNumber=
CKFINDER_CONNECTOR_ERROR_UPLOADED_INVALID_NAME_RENAMED;
}
在這段代碼之后添加
$sExtension=CKFinder_Connector_Utils_FileSystem::getExtension
($sFileName);
$sFileName=date('YmdHis').'.'.$sExtension;