`

FCKEDITOR

 
阅读更多

项目需要在线HTML编辑器,就选择了FCKeditor,目前最新是2.5Bate,不过稳定点定还是选了2.4.3,而.net的控件还是2.2没变过 [smile] ,大概如何使用见我之前的“FCKeditor 2.3 在ASP.NET中文件上传路径的设置”,关于它的配置如:界面布局啊什么的网上去搜索下,太多了,就不写了 [smile] 
  FCKeditor在web.config中有多项设置:
view plaincopy to clipboardprint?
<appSettings>  
<!--FCKeditor设置(主要是以下两项)-->  
<!--FCKeditor编辑器路径-->  
<add key="FCKeditor:BasePath" value="/FCKeditor/"/>  
<!--FCKeditor用户附件上传路径-->  
<add key="FCKeditor:UserFilesPath" value="/Resources/TempUpload/"/>  
</appSettings>  
  用户登录后通过FCKeditor上传文件则要放置在用户共用上传路径“/Resources/UserUpload/”+“用户邮箱地址”,如“/Resources/UserUpload/user@gmail.com”。FCKeditor.net获取上传路径文件是:FileWorkerBase.cs,打开找到以下部分
view plaincopy to clipboardprint?
 protected string UserFilesPath  
    {  
      get  
      {  
        if ( sUserFilesPath == null )  
        {  
          // 第一回从Application["FCKeditor:UserFilesPath"] 中读取,如果没有尝试其它方式  
          sUserFilesPath = (string)Application["FCKeditor:UserFilesPath"] ;  
  
          // 第二回从Session["FCKeditor:UserFilesPath"] 中读取,如果没有尝试其它方式  
          if ( sUserFilesPath == null || sUserFilesPath.Length == 0 )  
          {  
            sUserFilesPath = (string)Session["FCKeditor:UserFilesPath"] ;  
              
            // 第三回从web.config中读取,如果没有尝试其它方式  
            if ( sUserFilesPath == null || sUserFilesPath.Length == 0 )  
            {  
              sUserFilesPath = System.Configuration.ConfigurationSettings.AppSettings["FCKeditor:UserFilesPath"] ;  
                
              // 第四回从DEFAULT_USER_FILES_PATH(这个变量在同文件中)中读取,如果没有尝试其它方式  
              if ( sUserFilesPath == null || sUserFilesPath.Length == 0 )   
                sUserFilesPath = DEFAULT_USER_FILES_PATH ;  
  
              // 第五回从网址参数ServerPath中读取  
              if ( sUserFilesPath == null || sUserFilesPath.Length == 0 )   
              {  
                sUserFilesPath = Request.QueryString["ServerPath"] ;  
              }  
  
            }  
          }  
  
          // Check that the user path ends with slash ("/")  
          if ( ! sUserFilesPath.EndsWith("/") )  
            sUserFilesPath += "/" ;  
        }  
        return sUserFilesPath ;  
      }  
    }  
  从上面的注释可以看到用户上传路径的顺序,只要在页面加载的时候设置下Session["FCKeditor:UserFilesPath"]就可以设置FCKeditor上用户上传路径了
view plaincopy to clipboardprint?
protected void Page_Load(object sender, EventArgs e)  
{  
 if (!Page.IsPostBack)  
 Session["FCKeditor:UserFilesPath"] = "用户上传路径";  
}  
  (我在配置的时候关闭了文件浏览,只提供文件快速上传)但是在使用的时候如果“Resources/UserUpload/user@gmail.com”中的user@gmail.com路径没创建,上传中FCKeditor它不会创建,也导致了文件无法上传成功,那就需要再修改FCKeditor.net项目中的Uploader.cs文件,添加一段文件夹存在的检测代码,如果不存在用户指定的文件夹侧创建一个
view plaincopy to clipboardprint?
// Get the uploaded file name.  
string sFileName = System.IO.Path.GetFileName( oFile.FileName ) ;  
  
int iCounter = 0 ;  
  
//景裔添加  
//检查上传目录是否已经被创建  
//开始==========================================  
//检查当前完整路径是否存在,不存在则开始逐级轮询检查,不存则就创建  
if (!System.IO.Directory.Exists(UserFilesDirectory))  
{  
string[] tempDirectorys = UserFilesDirectory.Split(new string[] { "\\" }, StringSplitOptions.RemoveEmptyEntries); 
string tempDirectory = string.Empty; 
for (int i = 0; i < tempDirectorys.Length; i++) 

tempDirectory += tempDirectorys[i] + "\\"; 
if (!System.IO.Directory.Exists(tempDirectory)) 
System.IO.Directory.CreateDirectory(tempDirectory); 


//结束========================================== 
 
while ( true ) 

string sFilePath = System.IO.Path.Combine( this.UserFilesDirectory, sFileName ) ; 
 
if ( System.IO.File.Exists( sFilePath ) ) 

iCounter++ ; 
sFileName =  
System.IO.Path.GetFileNameWithoutExtension( oFile.FileName ) + 
"(" + iCounter + ")" +  
System.IO.Path.GetExtension( oFile.FileName ) ;  
  
iErrorNumber = 201 ;  
}  
else  
{  
oFile.SaveAs( sFilePath ) ;  
  
sFileUrl = this.UserFilesPath + sFileName ;  
break ;  
}  
}  
  这样就基本解决了多用户分文件夹上传图片的问题,不过也有缺陷的地方,就是当用户Session超时的时候,用户再使用浏览器上传文件就不会按照指定用户文件夹上传来了,分析这个情况可以得出:这个时候用户通过编辑器上传的文件也就是对编辑器内容作出了修改,但是因为Session超时了,所以可以把做出的修改视作无效,既然修改无效,那用户上传的文件也是没用的,所在我在web.config中又设置了个默认文件上传位置,所有无效文件都会上传到这里,那个回清理的时候也方便多了 [lol] 不知道哪位大虾还有更好的办法。

分享到:
评论

相关推荐

    PHP FCKeditor_2.6.6 瘦身精简版 带重命名上传+实例使用说明

    将Fckeditor 里的保留文件拷贝到网站根目录文件夹里,即/ictech/下 /fcktemplates.xml /fckstyles.xml /fckeditor_php5.php /fckeditor_php4.php /fckeditor.php /fckeditor.js /fckconfig.js /editor/ fckeditor....

    fckeditor for jsp 的jar包

    这个是一个我修改过的fckeditor for jsp 的jar包的源代码,是fckeditor-2.3的,我修改了ConnectorServlet.java和SimpleUploaderServlet.java两个文件 我在这两个文件中都是加了一个静态变量encoding,private static...

    最新FCKeditor_2.6 版本 FCKeditor编辑器和控件

    兼容目前的浏览器 里面包含FCKeditor编辑器和控件 一、集成方法 FCKeditor应用在ASP.NET上,需要两组文件,一组是FCKeditor本身,另一个是用于ASP.NET的FCKeditor控件(分为1.1和2.0两个版本,这里使用2.0版本)。 ...

    fckeditor2.6.3 完整版

    2.解压缩到你的站点根文件夹中名为FCKEDITOR的文件夹中(名称必须为FCKEDITOR,因为配置文件中已经使用此名称来标示出FCKEDITOR的位置) 3.现在,编辑器就可以使用了,如果想要查看演示,可以按下面方法访问: ...

    FCKeditor.Net_2.6.3.zip和FCKeditor-v2.6.3

    FCKeditor.Net_2.6.3.zip和FCKeditor-v2.6.3

    FCKeditor2.6.4使用说明

    1 FCKeditor简介: FCKeditor是一个专门使用在网页上属于开放源代码的所见即所得文字编辑器。它志于轻量化,不需要太复杂的安装步骤即可使用。它可和PHP、JavaScript、ASP、ASP.NET、ColdFusion、Java、以及ABAP等...

    FCKeditor_2.6.3.zip+FCKeditor-2.3.zip

    FCKeditor是一个专门使用在网页上属于开放源代码的所见即所得文字编辑器。它志于轻量化,不需要太复杂的安装步骤即可使用。它可和PHP、JavaScript、ASP、ASP.NET、ColdFusion、Java、以及ABAP等不同的编程语言相结合...

    .net 配置好的Fckeditor2.6.5

    Fckeditor2.6.5 Build 23959 1.将得到的fckeditor文件夹复制到网站的目录下面 2.配置WebConfig appSettings&gt; &lt;add key="FCKeditor:BasePath" value="~/fckeditor/"/&gt; &lt;add key="FCKeditor:UserFilesPath" ...

    Fckeditor皮肤Fckeditor皮肤

    Fckeditor皮肤Fckeditor皮肤Fckeditor皮肤Fckeditor皮肤Fckeditor皮肤Fckeditor皮肤

    FCKeditor_2.6.6.zip

    FCKEDITOR的性能是非常好的,用户只需很少的时间就可以载入FCKEDITOR所需文件.对于其他在线编辑器来说,这几乎是个很难解决的难题,因为在开启编辑器时需要装载太多的文件.比如CUTEEDITOR,虽然功能比FCKEDITOR还要强大,...

    FCKEDITOR-2.6.3 代码高亮与图片水印

    FCKEDITOR-2.6.3 代码高亮与图片水印 VS2005,VS2008下. FCKeditor增加了代码高亮显示,和图片水印功能 经过X8023Z团队修改精简.并附个人配置经验. 常见错误问题: 1:找不到文件,那就是说路径没有设置好. &lt;add key="...

    java /jsp FCKeditor 配置

    通过复制粘贴实现FCKeditor 的使用. 看拉大家的留言,为使大家下载多能使用,补充个注意点; 在jsp页面出现FCKeditor 引用错误. 把页面中的下面代码中 id="infoContent" basePath="../../FCKeditor/" width="822" ...

    Fckeditor(综合利用工具)

    Fckeditor(综合利用工具)

    fckeditor编辑器上传文件(含视频音频)详细配置

    &lt;FCKeditorV2:FCKeditor ID="FCKeditor1" BasePath="fckeditor/" runat="server" Height="500px"&gt;&lt;/FCKeditorV2:FCKeditor&gt; (2)集成到Visual Studio工具箱 打开一ASP.NET页面,展开Toolbox,打开右键菜单,选择...

    FCKeditor_2.6.4+fckeditor-java-2.4.1_BMW修改版

    由官网FCKeditor_2.6.4+fckeditor-java-2.4.1修改。 修改内容有: 1、上传的文件名为中文会变成乱码 2、新建中文目录变乱码(这个好似还有点小问题,不过不影响使用,还是不建议用中文目录) 3、对上传的文件使用...

    fckeditor_2.6精简第三版

    所以只好继续精简FCKeditor,以前一直有个问题困扰着我,明明去掉了这么多代码,体积成倍缩小,为什么还这么慢,难道FCKeditor内核的问题?为了这次能更彻底提高FCKeditor的载入效率。我把所有压缩过的代码都还原。...

    FckEditor入门文档+实例Demo(可运行)

    自己写的 FckEditor 入门文档 文档中包括FckEditor 介绍、配置、实例讲解和拷贝网上其它例子文章等,已经算是很全面的文档了,20多页的PDF。 还额外赠送Demo实例,直接用Tomcat就可以运行,配置都弄好了,jar包都...

    Fckeditor2.6.3

    FCKeditor相关资料简介: (要下载FCKeditor2.6.zip和FCKeditor.NET2.5版的2个zip包) FCKeditor2.6zip是其最新的Javascript文件和图片等; FCKeditor.NET.zip是一个ASP.NET控件DLL文件。 下面结合一个ASP.NET...

    FCKeditor添加删除功能

    改造背景: FCK作为开源的文章编辑器,很受欢迎,却没有文件删除功能。 改造目标: 提升FCK的功能,提供删除文件和文件夹的管理功能。...2:com\fredck\FCKeditor\connector\ConnectorServlet.java

    fckeditor for JAVA所需要的所有文件

    fckeditor for JAVA所需要的所有文件 包括: FCKeditor_2.6.3.zip //主文件 fckeditor-java-2.4.1-bin.zip //jsp整合包 fckeditor-java-demo-2.4.1.war //完整的项目实例,建议部署到服务器上面看一下这个然后...

Global site tag (gtag.js) - Google Analytics