搜索 | 会员  
实现FCKeditor多用户分文件夹上传图片等附件
来源: http://web.rdxx.com/ASPNET/ASPNET_EDU/2008/12/1216   作者:佚名  日期:2009/2/2  类别:云计算  主题:  编辑:dezai
FCKeditor在web.config中有多项设置:view plaincopy to clipboardprint?ppSettings !--FCKeditor设置(主要是以下两项)--&nb
FCKeditor在web.config中有多项设置:view plaincopy to clipboardprint?
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  用户登录后通过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 ;  
      }  
    }  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"] = "用户上传路径";  

德仔网尊重行业规范,每篇文章都注明有明确的作者和来源;德仔网的原创文章,请转载时务必注明文章作者和来源:德仔网;
头条那些事
大家在关注
广告那些事
我们的推荐
也许感兴趣的
干货