日本好好热aⅴ|国产99视频精品免费观看|日本成人aV在线|久热香蕉国产在线

  • <cite id="ikgdy"><table id="ikgdy"></table></cite>
    1. 西西軟件園多重安全檢測下載網(wǎng)站、值得信賴的軟件下載站!
      軟件
      軟件
      文章
      搜索

      首頁編程開發(fā)ASP.NET → .NET下FCKeditor動態(tài)設(shè)置不同用戶使用不同的文件上傳路徑

      .NET下FCKeditor動態(tài)設(shè)置不同用戶使用不同的文件上傳路徑

      相關(guān)軟件相關(guān)文章發(fā)表評論 來源:本站整理時間:2010/11/29 15:30:04字體大小:A-A+

      作者:佚名點擊:160次評論:0次標(biāo)簽: fckeditor CMS DEDEMS 火車頭

      • 類型:網(wǎng)頁編輯大。1.2M語言:中文 評分:6.6
      • 標(biāo)簽:
      立即下載
      首先看一下FCKeditor是如何獲取用戶的文件夾路徑設(shè)置的,以及獲取的順序:

      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 ;
      // 第五回從網(wǎng)址參數(shù)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 ;

      // 第五回從網(wǎng)址參數(shù)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中指定了路徑就可以實現(xiàn)動態(tài)路徑或多用戶多路徑了,下面看我的代碼:

      protected void Page_Load(object sender, EventArgs e)
      {
      Session["UserID"] = "12345679";
      string URL = Session["UserID"].ToString();
      Session["FCKeditor:UserFilesPath"]="~/factory/" + URL + "/UpLoadFile/";
      }

      在頁面載入時設(shè)置用戶的Session["UserID"],為不同用戶指定一個ID,然后設(shè)置一下文件要上傳了路徑,動態(tài)的路徑Session["FCKeditor:UserFilesPath"]是用Session["UserID"]結(jié)合我們的網(wǎng)站目錄生成的一個路徑。當(dāng)然也可以直接在Session指定一個路徑,然后賦值給Session["FCKeditor:UserFilesPath"]。

      至此,我們簡單的解決了fckeditor動態(tài)設(shè)置文件上傳路徑,解決多用戶多路徑的問題。

        相關(guān)評論

        閱讀本文后您有什么感想? 已有人給出評價!

        • 8 喜歡喜歡
        • 3 頂
        • 1 難過難過
        • 5 囧
        • 3 圍觀圍觀
        • 2 無聊無聊

        熱門評論

        最新評論

        第 1 樓 云南教育網(wǎng)直通車 網(wǎng)友 客人 發(fā)表于: 2011/2/18 16:34:36
        bgtghg

        支持( 0 ) 蓋樓(回復(fù))

        發(fā)表評論 查看所有評論(0)

        昵稱:
        表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
        字?jǐn)?shù): 0/500 (您的評論需要經(jīng)過審核才能顯示)