
FCKeditor(HTML在線(xiàn)編輯器)V2.6.3正式版
- 類(lèi)型:網(wǎng)頁(yè)編輯大小:1.2M語(yǔ)言:中文 評(píng)分:6.6
- 標(biāo)簽:
FCKeditor.net獲取上傳路徑文件是:FileWorkerBase.cs,打開(kāi)找到以下部分view plaincopy to clipboardprint?
protected string UserFilesPath
{
get
{
if ( sUserFilesPath == null )
{
// 第一回從application["FCKeditor:UserFilesPath"] 中讀取,如果沒(méi)有嘗試其它方式
sUserFilesPath = (string)Application["FCKeditor:UserFilesPath"] ;
// 第二回從session["FCKeditor:UserFilesPath"] 中讀取,如果沒(méi)有嘗試其它方式
if ( sUserFilesPath == null || sUserFilesPath.Length == 0 )
{
sUserFilesPath = (string)Session["FCKeditor:UserFilesPath"] ;
// 第三回從web.config中讀取,如果沒(méi)有嘗試其它方式
if ( sUserFilesPath == null || sUserFilesPath.Length == 0 )
{
sUserFilesPath = System.Configuration.ConfigurationSettings.AppSettings["FCKeditor:UserFilesPath"] ;
// 第四回從DEFAULT_USER_FILES_PATH(這個(gè)變量在同文件中)中讀取,如果沒(méi)有嘗試其它方式
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"] 中讀取,如果沒(méi)有嘗試其它方式
sUserFilesPath = (string)Application["FCKeditor:UserFilesPath"] ;
// 第二回從Session["FCKeditor:UserFilesPath"] 中讀取,如果沒(méi)有嘗試其它方式
if ( sUserFilesPath == null || sUserFilesPath.Length == 0 )
{
sUserFilesPath = (string)Session["FCKeditor:UserFilesPath"] ;
// 第三回從web.config中讀取,如果沒(méi)有嘗試其它方式
if ( sUserFilesPath == null || sUserFilesPath.Length == 0 )
{
sUserFilesPath = System.Configuration.ConfigurationSettings.AppSettings["FCKeditor:UserFilesPath"] ;
// 第四回從DEFAULT_USER_FILES_PATH(這個(gè)變量在同文件中)中讀取,如果沒(méi)有嘗試其它方式
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中指定了路徑就可以實(shí)現(xiàn)動(dòng)態(tài)路徑或多用戶(hù)多路徑了,下面看我的代碼:
protected void Page_Load(object sender, EventArgs e)
{
Session["UserID"] = "12345679";
string URL = Session["UserID"].ToString();
Session["FCKeditor:UserFilesPath"]="~/factory/" + URL + "/UpLoadFile/";
}
在頁(yè)面載入時(shí)設(shè)置用戶(hù)的Session["UserID"],為不同用戶(hù)指定一個(gè)ID,然后設(shè)置一下文件要上傳了路徑,動(dòng)態(tài)的路徑Session["FCKeditor:UserFilesPath"]是用Session["UserID"]結(jié)合我們的網(wǎng)站目錄生成的一個(gè)路徑。當(dāng)然也可以直接在Session指定一個(gè)路徑,然后賦值給Session["FCKeditor:UserFilesPath"]。
至此,我們簡(jiǎn)單的解決了fckeditor動(dòng)態(tài)設(shè)置文件上傳路徑,解決多用戶(hù)多路徑的問(wèn)題。