SoFunction
Updated on 2025-04-07

FCKEditor Custom user directory modification steps (with source code)

Due to my network reasons, I didn't need to download the source code from the official website of FCK...
This set of source code is decompiled by FCK2.2 version
Source code:Click here to downloadThe main modifications in the source code have been commented
The roughly modified is as follows:
Get the source code of the user directory:
Here are some comments
In the program, you can directly specify when the user logs in
This solution is just to facilitate the use of multiple users to specify different file directories for users
Session["FCKeditor:UserFilesPath"]="User File Relative Directory";

Copy the codeThe code is as follows:

/// <summary>
/// User file directory
/// </summary>
protected string UserFilesPath
{
get
{
if ( == null)
{
//Read from APPlictaion
= (string)["FCKeditor:UserFilesPath"];
if (( == null) || ( == 0))
{
//Read from Session
= (string)["FCKeditor:UserFilesPath"];
if (( == null) || ( == 0))
{
//Read from site configuration file
= ["FCKeditor:UserFilesPath"];
if (( == null) || ( == 0))
{
= "/UpLoadFiles/";
}
if (( == null) || ( == 0))
{
//Read from URL
= ["ServerPath"];
}
}
}
if (!("/"))
{
= + "/";
}
}
return ;
}
}

After specifying this, you will find that the FCK needs Image, Files and other folders
Modify this file: Uploader .cs (Download address)
The modified upload file operation class is here: (If you want to modify the original version, you don’t have to get this class file into your web program directory. I just want to use the methods in APP_Code in my project, and I won’t repeat it below!)
Fckeditor\editor\filemanager\upload\aspx\
I forgot to record it when I modified it... It seems that nothing has been changed here, I just made some comments
Uh found here FileBrowserConnector
Fckeditor\editor\filemanager\browser\default\connectors\aspx\(Modified address)
Copy the codeThe code is as follows:

/// <summary>
/// Select folder according to file type
/// </summary>
/// <param name="resourceType"></param>
/// <param name="folderPath"></param>
/// <returns></returns>
private string ServerMapFolder(string resourceType, string folderPath)
{
//2010-3-29 14:00:56
//string path = (, resourceType);
string path = ;
(path);
return (path, (new char[] { '/' }));
}

This is the resourceType that is directly excluded (remove the judging file type)
This method will affect the image path after the selected image
Copy the codeThe code is as follows:

private string GetUrlFromPath(string resourceType, string folderPath)
{
if ((resourceType == null) || ( == 0))
{
return ((new char[] { '/' }) + folderPath);
}
//2010-3-29 14:00:20 HYZ
//return ( + resourceType + folderPath);
string p= + folderPath;//Added
p=("//","/");//Add new
return (p);//Add new
}

Then some codes are modified in other HTML files
1. Translated prompt information
I won't talk about this... It's very simple. You can also search the full text based on the prompt information...
2. Modify the sample text of the selected image to Chinese
File is located at line 52
Fckeditor\editor\dialog\fck_image\fck_image_preview.html
3. Modify the file browser and add file preview (the effect is very rough)
The experts have made some changes and look good, but I hope I can send you a copy...
The file is located at:
Fckeditor\editor\filemanager\browser\default\
I have modified the js display preview effect on line 63 here
Of course there are also custom expressions and other things...
But because the project currently needs only a few things, I am too lazy to do it...
Source code:Click here to download
Please indicate the source when reprinting: