1. Implement fckeditor to store uploaded files in directories by date, For example, today is May 5, 2015, then the files uploaded today will be placed in this directory, and the files uploaded tomorrow will be automatically created and placed in a directory similar to 2015-05-06.
(1) Find the config.php file in the editoreditorfilemanagerconnectorsphp folder
(2) Find the following configuration variables
View code print
Copy code The code is as follows:
$Config['UserFilesPath'] = '/uploadfiles/';
Change its value to:
View code print
Copy code The code is as follows:
$Config['UserFilesPath'] = '/uploadfiles/'.date('Y-m-d').'/';
The uploaded files are stored according to date.
2. How to rename files uploaded by fckeditor
(1) Find the editoreditorfilemanagerconnectorsphpio.php file:
(2) Find the following content:
Copy code The code is as follows:
......
function SanitizeFileName( $sNewFileName ){
global $Config ;
$sNewFileName = stripslashes( $sNewFileName ) ;
if ( $Config['ForceSingleExtension'] )
$sNewFileName = preg_replace( '/\.(?![^.]*$)/', '_', $sNewFileName ) ;
$sNewFileName = preg_replace( '/\\|\/|\||\:|\?|\*|"|<|>/', '_', $sNewFileName );
return $sNewFileName ;
}
......
was changed to:
Copy code The code is as follows:
function SanitizeFileName( $sNewFileName ){
global $Config ;
$sNewFileName = stripslashes( $sNewFileName ) ;
if ( $Config['ForceSingleExtension'] )
$sNewFileName = preg_replace( '/\.(?![^.]*$)/', '_', $sNewFileName ) ;
//Get extension
$sExtension = substr( $sNewFileName, ( strrpos($sNewFileName, '.') 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
$sNewFileName = date("YmdHis").'.'.$sExtension;
return $sNewFileName ;
}
Uploaded files will now be automatically renamed.