FCKEditor v2.6 Editor Configuration Diagram Tutorial _ Web page Editor

Source: Internet
Author: User
Tags file upload httpcontext
The basic steps for integrating FCKEditor v2.6 (currently the latest version) are as follows:
1. Download FCKeditor 2.6 Basic files (main Code). Copy the extracted files to the project's EDITORS/FCKEDITORV2 directory.
2. Download the Fckeditor.net/asp.net control and copy the FredCK.FCKeditorV2.dll file to the project's Bin directory.

This basically allows you to fckeditor the v2.6 editor, and of course you need to set the default editor in host settings.
For some basic configuration information about FCKEditor, please refer to the following article:

If you need to use the File upload feature, you will also need to modify the code Fckeditorv2/editor/filemanager/connectors/config.ascx (for example, in ASPX code). This restricts only logged-in users to the ability to upload files, and uploads can only be uploaded to the user's own directory. Automatically create the corresponding file upload directory based on each user name.


Connectors/config.ascx The updated code is as follows:
Copy Code code as follows:

/**
* This function must check the "user session" to "sure" he/she is
* Authorized to upload and access files in the File Browser.
*/
private string M_username;
private int M_userid;
private int m_boardid;
private bool m_isauthenticated;

private bool Checkauthentication ()
{
Warning:do not simply return "true". By doing so, your are allowing
"Anyone" to upload and list the files in your server. You must implement
Some kind of validation here. Even something very simple as ...
//
Return (session["isauthorized"]!= null && (BOOL) session["isauthorized"] = = true);
//
... where session["isauthorized" is set to "true" as soon as the
User logs in your system.

string userName = HttpContext.Current.User.Identity.Name;

Try
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
string[] parts = Username.split (';');
if (parts. Length = = 3)
{
M_userid = Int. Parse (Parts[0]);
M_boardid = Int. Parse (Parts[1]);
M_username = parts[2];
M_isauthenticated = true;
}
}
}
catch (Exception)
{
M_username = "";
M_userid = 0;
M_boardid = 0;
m_isauthenticated = false;
}

return m_isauthenticated;
}

public override void Setconfig ()
{
Security:you must explicitly enable this "connector". (Set it to "true").
Enabled = Checkauthentication ();

URL path to user files.
Userfilespath = "/userfiles/";

The connector tries to resolve the above Userfilespath automatically.
Use the following setting it your prefer to explicitely specify the
Absolute path. Examples: ' c:\\mysite\\userfiles\\ ' or '/root/mysite/userfiles/'.
Attention:the above ' Userfilespath ' URL must point to the same directory.
Userfilesabsolutepath = "";

Due to security issues with Apache modules, it's recommended to leave the
Following setting enabled.
Forcesingleextension = true;

Allowed Resource Types
Allowedtypes = new string[] {"File", "Image", "Flash", "Media"};

For security, HTML was allowed in the
Following extensions only.
Htmlextensions = new string[] {"html", "HTM", "xml", "xsd", "txt", "JS"};

typeconfig["File"]. Allowedextensions = new string[] {"7z", "AIFF", "ASF", "Avi", "BMP", "CSV", "Doc", "FLA", "FLV", "gif", "GZ", "gzip", "JP Eg "," JPG "," mid "," mov "," MP3 "," mp4 "," MPC "," MPEG "," MPG "," ODS "," ODT "," PDF "," png "," ppt "," pxd "," QT "," Ram "," RAR " , "rm", "RMI", "RMVB", "RTF", "SDC", "SITD", "SwF", "SxC", "Sxw", "tar", "tgz", "TIF", "TIFF", "TXT", "VSD", "WAV", "WMA", "WMV", "XLS", "xml", "Zip"};
typeconfig["File"]. Deniedextensions = new string[] {};
string filepath = "%userfilespath%" + m_username + "/file/";
typeconfig["File"]. Filespath = filepath;
typeconfig["File"]. Filesabsolutepath = (Userfilesabsolutepath = = "" "" ":"%userfilesabsolutepath%file/");
typeconfig["File"]. Quickuploadpath = filepath; "%userfilespath%" + m_username + "/";
typeconfig["File"]. Quickuploadabsolutepath = filepath; (Userfilesabsolutepath = = ""? "": "%userfilesabsolutepath%");

typeconfig["Image"]. Allowedextensions = new string[] {"BMP", "GIF", "JPEG", "JPG", "PNG"};
typeconfig["Image"]. Deniedextensions = new string[] {};
String ImagePath = "%userfilespath%" + m_username + "/image/";
typeconfig["Image"]. Filespath = ImagePath;
typeconfig["Image"]. Filesabsolutepath = (Userfilesabsolutepath = = "" "" ":"%userfilesabsolutepath%image/");
typeconfig["Image"]. Quickuploadpath = ImagePath; "%userfilespath%" + m_username + "/";
typeconfig["Image"]. Quickuploadabsolutepath = (Userfilesabsolutepath = = "" "" ":"%userfilesabsolutepath% ");

typeconfig["Flash"]. Allowedextensions = new string[] {"swf", "flv"};
typeconfig["Flash"]. Deniedextensions = new string[] {};
typeconfig["Flash"]. Filespath = "%userfilespath%flash/";
typeconfig["Flash"]. Filesabsolutepath = (Userfilesabsolutepath = = "" "" ":"%userfilesabsolutepath%flash/");
typeconfig["Flash"]. Quickuploadpath = "%userfilespath%";
typeconfig["Flash"]. Quickuploadabsolutepath = (Userfilesabsolutepath = = "" "" ":"%userfilesabsolutepath% ");

typeconfig["Media"]. Allowedextensions = new string[] {"AIFF", "ASF", "Avi", "BMP", "FLA", "FLV", "GIF", "JPEG", "JPG", "mid", "mov", "MP3", " MP4 "," MPC "," mpeg, "MPG", "png", "QT", "Ram", "RM", "RMI", "RMVB", "SwF", "TIF", "TIFF", "WAV", "WMA", "WMV"};
typeconfig["Media"]. Deniedextensions = new string[] {};
typeconfig["Media"]. Filespath = "%userfilespath%media/";
typeconfig["Media"]. Filesabsolutepath = (Userfilesabsolutepath = = "" "" ":"%userfilesabsolutepath%media/");
typeconfig["Media"]. Quickuploadpath = "%userfilespath%";
typeconfig["Media"]. Quickuploadabsolutepath = (Userfilesabsolutepath = = "" "" ":"%userfilesabsolutepath% ");
}

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.