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

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

自动刷新从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 分享

ckeditor syntaxhighlighter代码高亮插件,完美修复

昨天匆忙发了个更新版,今天去找ckeditor的api文档看了很久,终于找到解决办法了
收藏 0 赞 0 分享

FCKeditor .NET的配置、扩展与安全性经验交流

FCKeditor是使用非常广泛的HTML编辑器,本文从 ASP.NET 的使用场景对 FCKeditor 与 FCKeditor.NET 的配置、功能扩展(如自定义文件上传子目录、自定义文件名、上传图片的后期处理等)、以及安全性进行初步的阐述。
收藏 0 赞 0 分享

FCKeditor 图片上传进度条不动的解决方法

开发的“历史五千年”网站,使用FCKeditor,在本地上传图片一切正常,但昨天晚上实际向网络服务器(Windows Server 2003)发送图片时,发送图像进度条一直在滚动,无法关闭,通过FTP服务器查看服务器,图片已经传送上去,但这个滚动条却无法结束。
收藏 0 赞 0 分享
查看更多