fckeditor使用和报错处理

在FCKEditor2.6.6版在.net环境中图片上传的正确配置,以供大家参考,以少走弯路。
asp.net下的fckeditor2.6.4配置
用最简单的语言描述一下。其它配置和优化就不说了,只说怎么让它在asp.net环境下能用,能上传。
1、下载文件  http://www.fckeditor.net/download 
FCKeditor_2.6.6.zip   和   FCKeditor.Net_2.6.4.zip
这是目前最新的版本。 FCKeditor_2.4.1.zip 为fckeditor的页面文件 FCKeditor.Net_2.6.4.zip是asp.net下的上传用的 
dll控件和其源文件
2、 解压FCKeditor_2.6.6.zip  到网站根目录下的 fckeditor中,解压FCKeditor.Net_2.6.4.zip将其目录 FCKeditor.Net_2.6.4.zip/
bin/Release中的 FredCK.FCKeditorV2.dll 复制到 根目录的/bin/下
3、打开/fckeditor/fckconfig.js 修改两行代码
var _FileBrowserLanguage = 'aspx' ; 
var _QuickUploadLanguage = 'aspx' ;
把默认的asp语言改成aspx
4、这就算行了,开始用吧。根目录下建立test.aspx,其代码如下:
<%@ Page language="c#" AutoEventWireup="false" validateRequest=false%>
<%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %>
<form id="Form1" method="post" runat="server">
<FCKeditorV2:FCKeditor id="content" runat="server"></FCKeditorV2:FCKeditor>
</form>
应该就ok了,可以上传。默认传到根目录的/UserFiles/下,不用自己建,它自己会建。
如果要改上传目录,需要修改FCKeditor.Net_2.6.4.zip这个包里的.net源文件。修改FileWorkerBase.cs ,改一下26行
private const string DEFAULT_USER_FILES_PATH = "/UserFiles/" ;
重新编译一下,生成新的dll,复制过去,应该就OK了。(这个我没试,应该没问题)
   另外,说一句,fckeditor是很灵活的,可以做很多高级的设置。
还 有的网友,自己优化了它的源文件,有的给它加了功能,比如传视频,传文件什么的。 但这些修改过的版本,有的是有问题的。
 曾经下过一个修改了的2.0 版本, asp下,怎么设置都上传不了图片。 重新下个,随便设置一下就可以了。所以,
还是推荐大家用官方提供的版本。 
5,关于上传图片,如果上传图片的时候上传不了,或者报错:"this connector is disabled Please check the"editor/filemanager
/connectors/aspx/config.aspx" 

打开editor/filemanager/connectors/aspx/config.ascx修改CheckAuthentication()方法,返回true

C# code

private bool CheckAuthentication()
{
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session 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.

        return true;
}

 

6,

对于开发中使用FCKeditor文件上传功能遇到 XML request error: Internal Server Error(500) 错误的解决办法。

还有详细信息:"使用主题 css 文件要求页上有标头控件". 不是权限问题和路径错误,那是咋回事呢~? google一下,原来是主题惹的祸:
因为ASP.NET2.0新增了Theme功能,所以如果在你的工程中你对Web.config使用到了styleSheetTheme或theme的话那就要再多

修改一下。
还是到FCKeditor所在的目录,分别打开/editor/filemanager/upload/aspx/upload.aspx和/editor/filemanager/browser/

default/connectors/aspx/connector.aspx两个aspx文件,在page标签中添加Theme=""或StyleSheetTheme=""看你在工程使

用的是什么就修改什么。修改后如下:
<%@ Page language="c#" Inherits="FredCK.FCKeditorV2.Uploader" AutoEventWireup="false" Theme="" %>

<%@ Page language="c#" Inherits="FredCK.FCKeditorV2.Uploader" AutoEventWireup="false" StylesheetTheme="" %>
这样就解决了500的内部错误。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值