|
The latest version of CKEditor and Ckfinder can be downloaded from the official website (http://cksource.com).
Put the above two resources in the root directory of your Web site:/ckeditor and/ckfinder (case-insensitive)
Use CKEditor on the page:
<textarea cols= "id=" "Prcontent" name= "Content" rows= ">hello" world!</textarea>
<script type= "Text/javascript" >
Ckeditor.replace (' content ', {height:200, width:520});
</script>
The ckeditor itself does not carry the upload function, therefore needs to cooperate with Ckfinder only then can realize uploads
Step One: The website needs to refer to Ckfinder DLL (directory:/ckfinder/bin/release/ckfinder.dll)
Step Two: Configure the CKEditor config.js (directory:/ckeditor/config.js) in the Ckeditor.editorconfig function Plus, unwanted features can be removed
Config.filebrowserbrowseurl= '/ckfinder/ckfinder.html '; Browse Service folder when uploading files
Config.filebrowserimagebrowseurl= '/ckfinder/ckfinder.html? Type=images '; Browsing service folders when uploading pictures
Config.filebrowserflashbrowseurl= '/ckfinder/ckfinder.html? Type=flash '; Browse Service folder when uploading Flash
Config.filebrowseruploadurl = '/ckfinder/core/connector/aspx/connector.aspx?command=quickupload&type=files '; Upload file button (label)
Config.filebrowserimageuploadurl= '/ckfinder/core/connector/aspx/connector.aspx?command=quickupload&type= Images '; Upload Picture button (label)
Config.filebrowserflashuploadurl= '/ckfinder/core/connector/aspx/connector.aspx?command=quickupload&type= Flash '; Upload Flash button (label)
Configuration is completed after ckeditor with upload function, but if upload picture, the picture file is the original picture of the name, want to change to random filename, how to do. Then look at step three.
Step Three: Modify the source code of Ckfinder. Ckfinder from the source, directory:/ckfinde/_source
Create a new current item in VS to Ckfinde/_source/ckfinder.net.sln
1) Open/settings/configfile.cs file
Locate 27 rows and add an attribute: public bool randomrename; Random renaming
Locate 67 lines and assign a value to the property just now: Randomrename = true; The default value is True
Save Close File
2) Open/connector/config.cs file
Locate 62 lines and add an attribute:
public bool Randomrename
{
get {return Settings.ConfigFile.Current.RandomReName;}
}
Save Close File
3) Open/connector/commandhandlers/fileuploadcommandhandler.cs file
Locate 64 lines and add a judgment code:
if (Config.Current.RandomReName)//using random name
sFileName = DateTime.Now.ToString ("yyyymmddhhmmssfff") + "." + sextension;
Save Close File
4 Rebuild the project and cover the/ckfinder/_source/bin/debug/ckfinder.dll/ckfinder/bin/release/ CKFinder.dll or site projects removed before adding references and then re-ckfinder.net the DLL from the project
Last step: Open/ckfinder/config.ascx
Locate 42 lines, add a property: (In fact, this can not add, because there are previously set defaults, but use the original when you must set to false)
Use random filename after uploading
Randomrename = true;
Save shutdown
Well, this has been configured successfully, CKEditor can have upload function. Other features of the setup, free to continue to study ~
Also remind: There are many unwanted things in the CKEditor and Ckfinder folders, such as names with underscores, and. NET projects do not need to be php,asp.
If there is an error uploading the file: The file is not browsable for security reasons. Contact your system administrator and check the Ckfinder configuration file.
Need to modify the Config.ascx file
public override bool Checkauthentication ()
{ Reture false; }
Modified to:
public override bool Checkauthentication ()
{
For form validation
return request.isauthenticated;
Reture true; Not recommended for use
}
|