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"] = "用户上传路径";
}
德仔网尊重行业规范,每篇文章都注明有明确的作者和来源;德仔网的原创文章,请转载时务必注明文章作者和来源:德仔网;