c#方式
要添加CKEditor 和CKFinder两个DLL的引用
CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
_FileBrowser.BasePath = "/ckfinder/";
_FileBrowser.SetupCKEditor(CKEditor1);
JS方式
要添加<script src="/ckfinder/ckfinder.js" type="text/javascript"></script>JS引用
var editor = CKEDITOR.replace('CKEditor1');
CKFinder.setupCKEditor(editor, '/ckfinder/');
整合后,上传时报没有权限这是在 ckfinder/config.ascx 文件的CheckAuthentication方法中 return false造成的
如果无需任何验证都可以上传文件,直接return true或者加入一些条件。
在整合后出现"浏览服务器按钮"
如果不需要,可以在ckfinder/ckfinder.js 中找到 f.config.filebrowserFlashUploadUrl
在该属性赋值后加入代码
f.config.filebrowserBrowseUrl = undefined;
f.config.filebrowserImageBrowseUrl = undefined;
f.config.filebrowserUploadUrl = undefined;
其实这三个属性都是CKEditor.config下的属性,只要设为undefined就可以了
注:如果使用C#方式对CKEditor和 CKFinder进行整合,设置这三个属性无效,必须使用JS方式整合
或者在使用C#方式整合时,加上这三条代码
CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
_FileBrowser.BasePath = "/ckfinder/";
_FileBrowser.SetupCKEditor(CKEditor1);
CKEditor1.config.toolbar = new object[]
{
new object[] { "Bold", "Italic", "-", "NumberedList", "BulletedList", "-", "Link", "Unlink" },
new object[] { "Cut", "Copy", "Paste", "PasteText", "PasteFromWord", "-", "Print", "SpellChecker", "Scayt","-","Image" },
};
CKEditor1.config.filebrowserBrowseUrl = "";
CKEditor1.config.filebrowserImageBrowseUrl = "";
CKEditor1.config.filebrowserUploadUrl = "";
官方说明:
CKEDITOR.config.filebrowserBrowseUrl
The location of an external file browser that should be launched when the Browse Server button is pressed.
|
|
<static> |
CKEDITOR.config.filebrowserFlashBrowseUrl
The location of an external file browser that should be launched when the Browse Server button is pressed in the Flash dialog window.
|
<static> |
CKEDITOR.config.filebrowserFlashUploadUrl
The location of the script that handles file uploads in the Flash dialog window.
|
<static> |
CKEDITOR.config.filebrowserImageBrowseLinkUrl
The location of an external file browser that should be launched when the Browse Server button is pressed in the Link tab of the Image dialog window.
|
<static> |
CKEDITOR.config.filebrowserImageBrowseUrl
The location of an external file browser that should be launched when the Browse Server button is pressed in the Image dialog window.
|
<static> |
CKEDITOR.config.filebrowserImageUploadUrl
The location of the script that handles file uploads in the Image dialog window.
|
<static> |
CKEDITOR.config.filebrowserUploadUrl
The location of the script that handles file uploads.
|
玩技术,要学会忍受寂寞--