Fckeditor uploads files by date for storage and renaming. fckeditor uploads files
1. Implement fckeditor to store uploaded files in the form of a date-based directoryFor example, if today is July 22, all files uploaded today are stored in this directory. files uploaded tomorrow are automatically created and stored in directories similar to May 5, 2015.
(1) Find the config. php file in the editor \ filemanager \ connectors \ php \ folder.
(2) Find the following configuration variables:
View code printing
Copy codeThe Code is as follows:
$ Config ['userfilespath'] = '/uploadfiles /';
Modify the value:
View code printing
Copy codeThe Code is as follows:
$ Config ['userfilespath'] = '/uploadfiles/'. date ('Y-m-d ').'/';
In this way, the uploaded files are stored by date.
2. How to rename the File Uploaded By fckeditor
(1) Find the editor \ filemanager \ connectors \ php \ io. php file:
(2) Find the following content:
Copy codeThe 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;
}
......
To:
Copy codeThe Code is as follows:
Function SanitizeFileName ($ sNewFileName ){
Global $ Config;
$ SNewFileName = stripslashes ($ sNewFileName );
If ($ Config ['forcesingleextension'])
$ SNewFileName = preg_replace ('/\\.(?! [^.] * $)/',' _ ', $ SNewFileName );
// Obtain the extension
$ SExtension = substr ($ sNewFileName, (strrpos ($ sNewFileName, '.') + 1 ));
$ SExtension = strtolower ($ sExtension );
$ SNewFileName = date ("YmdHis"). '.'. $ sExtension;
Return $ sNewFileName;
}
Now the uploaded file will be automatically renamed.