Fckeditor2.6.3 generate the upload folder by date and rename the file name

Source: Internet
Author: User

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 );


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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.