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

所属分类: 网络编程 / 网页编辑器 阅读数: 1479
收藏 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;
}
这样上传的文件就可以实现重命名了。
更多精彩内容其他人还在看

基于开发中使用UEditor编辑器的注意事项详解

下面小编就为大家分享一篇基于开发中使用UEditor编辑器的注意事项详解。具有很好的参考价值。一起跟随小编过来看看吧,希望对大家有所帮助
收藏 0 赞 0 分享

使用 CodeMirror 打造属于自己的带高亮显示的在线代码编辑器

写这个的目的是因为之前项目里用到过 CodeMirror,觉得作为一款在线代码编辑器还是不错,也看到过有些网站用到过在线代码编辑,当然我不知道他们是用什么做的
收藏 0 赞 0 分享

详解React中的todo-list

这篇文章主要介绍了React中的todo-list的相关知识,非常不错,具有一定的参考借鉴价值,需要的朋友参考下吧
收藏 0 赞 0 分享

自动刷新从BrowserSync开始

Browsersync能让浏览器实时、快速响应您的文件更改(html、js、css、sass、less等)并自动刷新页面。下面小编来带大家了解下如何使用
收藏 0 赞 0 分享

使用Js获取、插入和更改FCKeditor编辑器里的内容

这篇文章主要介绍了使用Js获取、插入和更改FCKeditor编辑器里的内容,包括JS操作Fckeditor的一些常用方法,需要的朋友可以参考下
收藏 0 赞 0 分享

js获取富文本中的第一张图片(正则表达式)

这篇文章主要介绍了js获取富文本中的第一张图片url正则表达式及去除字符串里面的html标签的正则公式,需要的朋友可以参考下
收藏 0 赞 0 分享

js获取UEditor富文本编辑器中的图片地址

这篇文章主要介绍了js获取UEditor富文本编辑器中的图片地址,最简单的思路应该是先获取UEditor中的内容再将获取到的字符串转换成jquery对象,选择器找到img元素,获取src值
收藏 0 赞 0 分享

SyntaxHighlighter 去掉右侧滚动条的方法

SyntaxHighlighter这个是一个高亮插件。现在被用于很多网站的代码显示。但是SyntaxHighlighter3.0.83,由于自适应宽和高,导致一直有滚动条的问题
收藏 0 赞 0 分享

xhEditor 免费的国产HTML在线编辑器

在线编辑器,CKeditor+CKfinder的组合是首选的,可惜CKfinder要收费,黄金搭档只有1个是免费的,又不想用回老版本,所以站长只好另寻他路。
收藏 0 赞 0 分享

asp.net+FCKeditor上传图片显示叉叉图片无法显示的问题的解决方法

今天用FCKeditor上传图片的时候,图片可以上传成功,可是预览的时候却显示个叉叉,前台也是显示不出来,原来服务器需要配置下。
收藏 0 赞 0 分享
查看更多