展开全部
1.修改fckeditor/editor/filemanager/connectors/php/config.php
1)设置上传路径
$Config['Enabled'] = true ;
$Config['UserFilesPath'] = ‘/upfiles/’ ;
$Config['UserFilesAbsolutePath'] = $_SERVER['DOCUMENT_ROOT'].$Config['UserFilesPath'];
2)按时间自动生成目录 (如/upfiles/image/2009/06/202112272751.jpg)
$Config['AllowedExtensions']['File'] = array(‘7z’, ‘aiff’, ‘asf’, ‘avi’, ‘bmp’, ‘csv’,
‘doc’, ‘fla’, ‘flv’, ‘gif’, ‘gz’, ‘gzip’,
‘jpeg’, ‘jpg’, ‘mid’, ‘mov’, ‘mp3′, ‘mp4′,
‘mpc’, ‘mpeg’, ‘mpg’, ‘ods’, ‘odt’, ‘pdf’,
‘png’, ‘ppt’, ‘pxd’, ‘qt’, ‘ram’, ‘rar’,
‘rm’, ‘rmi’, ‘rmvb’, ‘rtf’, ’sdc’, ’sitd’,
’swf’, ’sxc’, ’sxw’, ‘tar’, ‘tgz’, ‘tif’,
‘tiff’, ‘txt’, ‘vsd’, ‘wav’, ‘wma’, ‘wmv’,
‘xls’, ‘xml’, ‘zip’) ;
$Config['DeniedExtensions']['File'] = array() ;
$cns_tmp_time= date(“Y”,time()).”/”.date(“m”, time()) .”/”;
$Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . ‘file/’ ; //这里什么也不添加
$Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’file/’ ; //这里什么也不添加
$Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] .’file/’ .$cns_tmp_time ;
$Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'].’file/’ .$cns_tmp_time ;
$Config['AllowedExtensions']['Image'] = array(‘bmp’,'gif’,'jpeg’,'jpg’,'png’) ;
$Config['DeniedExtensions']['Image'] = array() ;
$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . ‘image/’ ;
$Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’image/’ ;
$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] .’image/’ .$cns_tmp_time;
$Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'].’image/’ .$cns_tmp_time ;
$Config['AllowedExtensions']['Flash'] = array(’swf’,'flv’) ;
$Config['DeniedExtensions']['Flash'] = array() ;
$Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . ‘flash/’ ;
$Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’flash/’ ;
$Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] .’flash/’ .$cns_tmp_time;
$Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'].’flash/’ .$cns_tmp_time ;
$Config['AllowedExtensions']['Media'] = array(‘aiff’, ‘asf’, ‘avi’, ‘bmp’, ‘fla’,
‘flv’, ‘gif’, ‘jpeg’, ‘jpg’, ‘mid’,
‘mov’, ‘mp3′, ‘mp4′, ‘mpc’, ‘mpeg’,
‘mpg’, ‘png’, ‘qt’, ‘ram’, ‘rm’, ‘rmi’,
‘rmvb’, ’swf’, ‘tif’, ‘tiff’, ‘wav’,
‘wma’, ‘wmv’) ;
$Config['DeniedExtensions']['Media'] = array() ;
$Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . ‘media/’ ;
$Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’media/’ ;
$Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] .’media/’ .$cns_tmp_time;
$Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'].’media/’ .$cns_tmp_time ;
2.修改fckeditor/editor/filemanager/connectors/php/commands.php
1)修改自动生成随机文件名
a)添加函数
function GetRandID($prefix) {
//第一步:初始化种子
//microtime(); 是个数组
$seedstr =split(” “,microtime(),5);
$seed =$seedstr[0]*10000;
//第二步:使用种子初始化随机数发生器
srand($seed);
//第三步:生成指定范围内的随机数
$random =rand(1,10000);
$filename = date(“dHis”, time()).$random.’.’.$prefix;
return $filename;
}
b)应用函数
在函数function FileUpload( $resourceType, $currentFolder, $sCommand ) 中的if ( isset( $Config['SecureImageUploads'] ) ) 上面一行添加
$sOriginalFileName = $sFileName = GetRandID($sExtension);
1)设置上传路径
$Config['Enabled'] = true ;
$Config['UserFilesPath'] = ‘/upfiles/’ ;
$Config['UserFilesAbsolutePath'] = $_SERVER['DOCUMENT_ROOT'].$Config['UserFilesPath'];
2)按时间自动生成目录 (如/upfiles/image/2009/06/202112272751.jpg)
$Config['AllowedExtensions']['File'] = array(‘7z’, ‘aiff’, ‘asf’, ‘avi’, ‘bmp’, ‘csv’,
‘doc’, ‘fla’, ‘flv’, ‘gif’, ‘gz’, ‘gzip’,
‘jpeg’, ‘jpg’, ‘mid’, ‘mov’, ‘mp3′, ‘mp4′,
‘mpc’, ‘mpeg’, ‘mpg’, ‘ods’, ‘odt’, ‘pdf’,
‘png’, ‘ppt’, ‘pxd’, ‘qt’, ‘ram’, ‘rar’,
‘rm’, ‘rmi’, ‘rmvb’, ‘rtf’, ’sdc’, ’sitd’,
’swf’, ’sxc’, ’sxw’, ‘tar’, ‘tgz’, ‘tif’,
‘tiff’, ‘txt’, ‘vsd’, ‘wav’, ‘wma’, ‘wmv’,
‘xls’, ‘xml’, ‘zip’) ;
$Config['DeniedExtensions']['File'] = array() ;
$cns_tmp_time= date(“Y”,time()).”/”.date(“m”, time()) .”/”;
$Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . ‘file/’ ; //这里什么也不添加
$Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’file/’ ; //这里什么也不添加
$Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] .’file/’ .$cns_tmp_time ;
$Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'].’file/’ .$cns_tmp_time ;
$Config['AllowedExtensions']['Image'] = array(‘bmp’,'gif’,'jpeg’,'jpg’,'png’) ;
$Config['DeniedExtensions']['Image'] = array() ;
$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . ‘image/’ ;
$Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’image/’ ;
$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] .’image/’ .$cns_tmp_time;
$Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'].’image/’ .$cns_tmp_time ;
$Config['AllowedExtensions']['Flash'] = array(’swf’,'flv’) ;
$Config['DeniedExtensions']['Flash'] = array() ;
$Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . ‘flash/’ ;
$Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’flash/’ ;
$Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] .’flash/’ .$cns_tmp_time;
$Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'].’flash/’ .$cns_tmp_time ;
$Config['AllowedExtensions']['Media'] = array(‘aiff’, ‘asf’, ‘avi’, ‘bmp’, ‘fla’,
‘flv’, ‘gif’, ‘jpeg’, ‘jpg’, ‘mid’,
‘mov’, ‘mp3′, ‘mp4′, ‘mpc’, ‘mpeg’,
‘mpg’, ‘png’, ‘qt’, ‘ram’, ‘rm’, ‘rmi’,
‘rmvb’, ’swf’, ‘tif’, ‘tiff’, ‘wav’,
‘wma’, ‘wmv’) ;
$Config['DeniedExtensions']['Media'] = array() ;
$Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . ‘media/’ ;
$Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’media/’ ;
$Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] .’media/’ .$cns_tmp_time;
$Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'].’media/’ .$cns_tmp_time ;
2.修改fckeditor/editor/filemanager/connectors/php/commands.php
1)修改自动生成随机文件名
a)添加函数
function GetRandID($prefix) {
//第一步:初始化种子
//microtime(); 是个数组
$seedstr =split(” “,microtime(),5);
$seed =$seedstr[0]*10000;
//第二步:使用种子初始化随机数发生器
srand($seed);
//第三步:生成指定范围内的随机数
$random =rand(1,10000);
$filename = date(“dHis”, time()).$random.’.’.$prefix;
return $filename;
}
b)应用函数
在函数function FileUpload( $resourceType, $currentFolder, $sCommand ) 中的if ( isset( $Config['SecureImageUploads'] ) ) 上面一行添加
$sOriginalFileName = $sFileName = GetRandID($sExtension);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询