This article mainly introduced FCKeditor upload file by date and rename method, this article modified the relevant PHP file to achieve these two requirements, the need for friends can refer to the
1. Implementation of FCKeditor by date in the form of catalog upload files, such as today is May 5, 2015, so today uploaded files are placed in this directory, the uploaded tomorrow will be automatically created and placed in a similar directory like 2015-05-06.
(1) Locate the config.php file under the editoreditorfilemanagerconnectorsphp folder
(2) Find the following configuration variables
View Code Printing
The code is as follows:
$Config [' userfilespath '] = '/uploadfiles/';
Modify its value to:
View Code Printing
The code is as follows:
$Config [' userfilespath '] = '/uploadfiles/'. Date (' y-m-d '). " /';
The uploaded files are stored according to the date.
2. Rename FCKeditor uploaded file method
(1) Locate the editoreditorfilemanagerconnectorsphpio.php file:
(2) Find the following content:
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;
}
......
Modified to:
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;
}
The uploaded file is now automatically renamed.