Because all images Uploaded By FCKeditor are uploaded to the image folder by default, this is not conducive to management, and the uploaded file name cannot be automatically renamed. Some file names are uploaded in Chinese and also in Chinese, this will cause unnecessary troubles. To better manage and enable the uploaded files to be automatically classified into folders by time, we can make the following modifications to achieve the image uploading archiving on a monthly basis, automatically rename a file name based on the upload time:
First, decompress fckeditor.net_2.6.3.zip to modify the following parts of filebrowser/fileworkerbase. CS:
Replace the loop body of while (true) {}
// Int icounter = 0;
While (true)
{
String sfilepath = system. Io. Path. Combine (sserverdir, sfilename );
// Determine whether the date/year folder on the server already exists and does not exist
String sfiledir = datetime. Now. tostring ("yyyy-mm ");
If (! System. Io. Directory. exists (sserverdir + sfiledir ))
{
System. Io. Directory. createdirectory (sserverdir + sfiledir );
}
// Rename the file
Random random = new random ();
String rdnum = (10 + random. Next (99). tostring ();
Sfilename = sfiledir + "/" + datetime. Now. tostring ("yyyymmddhhmmss") + rdnum + "." + sextension;
// Save the file
Ofile. saveas (sserverdir + sfilename );
Break;
}
After modification, generate the DLL file and replace fredck. fckeditorv2.dll.
You can also directly download the replace of fredck. fckeditorv2.dll.
Please leave a message for a friend to download. Give me some motivation.