fckeditor php上传文件重命名的设置

所属分类: 网络编程 / 网页编辑器 阅读数: 1515
收藏 0 赞 0 分享
这里经过摸索:找到了一个重命名的方法,大家看看好不好使。
首先:我希望上传的文件根据日期来组织文件夹
请修改editor\editor\filemanager\connectors\php文件夹下的:config.php文件
找到如下的内容:
// Path to user files relative to the document root.
$Config['UserFilesPath'] =
修改为:
// Path to user files relative to the document root.
$Config['UserFilesPath'] = '/uploadfiles/'.date("Ym")."/" ;
这样上传的文件就按照日期存放了。
其次:重命名
请修改该文件夹下的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( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>/', '_', $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 ) ;
$sExtension = substr( $sNewFileName, ( strrpos($sNewFileName, '.') + 1 ) ) ;
$sNewFileName = my_setfilename().'.'.$sExtension;
return $sNewFileName ;
}
function my_setfilename(){
$gettime = explode(' ',microtime());
$string = 'abcdefghijklmnopgrstuvwxyz0123456789';
$rand = '';
for ($x=0;$x<12;$x++)
 $rand .= substr($string,mt_rand(0,strlen($string)-1),1);
return date("ymdHis").substr($gettime[0],2,6).$rand;
}
这样上传的文件就可以实现重命名了。
更多精彩内容其他人还在看

eWebEditor 上传文件提示格式不正确的解决方法

eWebEditor上传个别图片时出现:请选择一个有效的文件,支持的格式有(GIF|JPG|JPEG|BMP|PNG)!,在WINDOWSXP下使用该组件正常,却在WINDOWS2003上提示
收藏 0 赞 0 分享

xhEditor的异步载入实现代码

xhEditor的异步载入实现代码,需要的朋友可以参考下。
收藏 0 赞 0 分享

FCKeditor 编辑器插入代码功能实现步骤

4步轻松打造可以应用于任何FCK编辑器的CMS及其他程序,一个Fckeditor编辑器的插件,it560独家首发教程,无需增加字段,不修改代码,完全绿色环保。
收藏 0 赞 0 分享

配置fckeditor 实现图片的上传

配置fckeditor 实现图片的上传
收藏 0 赞 0 分享

FCKeditor提供了一个完整的JavaScript API

FCKeditor提供了一个完整的JavaScript API(Application Public Interface),你可以利用这些API来处理FCK编辑器,只要它被加载完成或在正在运行中.
收藏 0 赞 0 分享

fckediter javascript事件函数代码

fckediter javascript事件函数代码,另外fckeditor的可以扩展性不错,大家可以学习下,具体的代码,可以参考脚本之家以前发布的文章。
收藏 0 赞 0 分享

ASP FCKeditor在线编辑器使用方法

我用的是asp,FCKeditor没有使用帮助,网上google以下资料很多,但不是很全,不适合刚入门的菜鸟使用,通过我半天的使用经历,稍微做了些整理,便于大家学习.
收藏 0 赞 0 分享

ASP下使用FCKeditor在线编辑器的方法

有不少朋友现在也喜欢用asp下用fckeditor编辑器了,下面是具体的使用方法。需要的朋友可以参考下。
收藏 0 赞 0 分享

ASP.NET中FCKEDITOR在线编辑器的用法

FCKEDITOR在线编辑器在asp.net下的使用方法,需要的朋友可以参考下。
收藏 0 赞 0 分享

php下FCKeditor2.6.5网页编辑器的使用方法

php下FCKeditor2.6.5网页编辑器的使用方法,需要的朋友可以参考下。
收藏 0 赞 0 分享
查看更多