.NET下fckeditor动态设置文件上传路径
来源:互联网 发布:linux新建文件夹 编辑:程序博客网 时间:2024/06/15 12:06
首先看一下FCKeditor是如何获取用户的文件夹路径设置的,以及获取的顺序:
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中指定了路径就可以实现动态路径或多用户多路径了,下面看我的代码:
protected void Page_Load(object sender, EventArgs e)
{
Session["UserID"] = "12345679";
string URL = Session["UserID"].ToString();
Session["FCKeditor:UserFilesPath"]="~/factory/" + URL + "/UpLoadFile/";
}
在页面载入时设置用户的Session["UserID"],为不同用户指定一个ID,然后设置一下文件要上传了路径,动态的路径Session["FCKeditor:UserFilesPath"]是用Session["UserID"]结合我们的网站目录生成的一个路径。当然也可以直接在Session指定一个路径,然后赋值给Session["FCKeditor:UserFilesPath"]。
至此,我们简单的解决了fckeditor动态设置文件上传路径,解决多用户多路径的问题。
- .NET下fckeditor动态设置文件上传路径
- fckeditor上传文件设置
- fckeditor自定义动态上传路径
- fckeditor文件上传漏洞(.NET)
- FCKEditor-java-2.6 上传文件路径配置
- FCKeditor 2.3 在ASP.NET中文件上传路径的设置
- FCKeditor在线文本编辑器上传文件设置
- ASP.NET环境下配置FCKEditor并上传图片及其它文件
- ASP.NET环境下配置FCKEditor并上传图片及其它文件
- ASP.NET环境下配置FCKEditor并上传图片及其它文件
- ASP.NET环境下配置FCKEditor并上传图片及其它文件
- ASP.NET环境下配置FCKEditor并上传图片及其它文件
- ASP.NET环境下配置FCKEditor并上传图片及其它文件
- ASP.NET环境下配置FCKEditor并上传图片及其它文件
- ASP.NET环境下配置FCKEditor并上传图片及其它文件
- asp fckeditor简单配置和上传设置,上传文件改名
- FCKeditor 文件上传路径等参数的修改
- FCKeditor上传设置
- C链表基本操作 笔试常考类型
- 在word软件中使用MathType自动编号功能
- android中view界面的刷新
- Delphi调试dll文件
- 学习mvc---------------进行中
- .NET下fckeditor动态设置文件上传路径
- placement new, operator new and new operator (转)
- Mysql同步和主从设置
- Computer room's story—— (3)WYX——Scary系列2
- WCF系列(二)配置文件
- poj 3621
- JavaScript数据类型
- 添加删除修改用户命令
- 添加删除修改用户命令