[经验]
Godaddy Windows主机使用FCKEditor的文件上传问题解决方法
|
|
问题来源:http://bbs.idcspy.com/thread-116405-1-1.html
原文链接:http://www.iliawang.com/upload-by-fckeditor-installed-in-godaddy-windows-host/,转载请注明出处,谢谢。
最近买了个Godaddy的 Windows主机,发现问题比Linux的多得多,很多使用不便的地方,最常见的就属子目录网站中的文件采用相对根目录的相对路径问题,假如该 Windows主机绑定域名aaa.com,建了一个子目录bbb,绑定域名bbb.com,bbb目录中有一个子目录ccc,同时在主机根目录还有另外一个子目录ccc,如果在bbb.com中使用类似/ccc的相对路径,会定位到主机根目录的这个ccc目录,而不是bbb目录下的ccc目录。
而FCKEditor的文件上传保存目录就是相对根目录的,这样麻烦就来了,如果是子目录中的网站使用FCKEditor,那上传的文件都会保存到根目录去,也许有人会想到将ConfigUserFilesPath由/uploadfiles/改为/子目录名称 /uploadfiles/,但如果网站多了的话,还得一个个改,以后每加一个网站都需要改。解决这个问题我个人觉得最好的办法就是转化为绝对路径。这样也需要修改好fckeditor的相关文件,每次新加网站都用自己改造后的fckeditor就可以了。
修改方法如下(以下以fckeditor2.6.4在ASP环境中使用为例,假定fckeditor放在网站的editor目录中):
1、打开editor/editor/filemanager/connectors/asp/config.asp
修改第35行- ConfigUserFilesPath = "/userfiles/"
复制代码 改为- ConfigUserFilesPath = "http://"&Request.ServerVariables("HTTP_HOST")&"/upload/"&year(now())&right("0"&month(now()),2)&"/"
复制代码 2、打开editor/editor/filemanager/connectors/asp/io.asp
修改第50行- GetResourceTypeDirectory = Server.MapPath( ConfigQuickUploadPath.Item( resourceType ) )
复制代码 改为- GetResourceTypeDirectory = Server.MapPath( "../../../../.." & Replace(ConfigQuickUploadPath.Item( resourceType ),"http://"&Request.ServerVariables("HTTP_HOST"),"") )
复制代码 修改第56行- GetResourceTypeDirectory = Server.MapPath( ConfigFileTypesPath.Item( resourceType ) )
复制代码 改为- GetResourceTypeDirectory = Server.MapPath( "../../../../.." & Replace(ConfigFileTypesPath.Item( resourceType ),"http://"&Request.ServerVariables("HTTP_HOST"),"") )
复制代码 这样保存的文件便会存在网站的upload目录中,并按照月份自动新建目录。 |
|
|
|
|
|
|
|
|
|
|
add.c
发表于 2010-9-7 10:35:21
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
贰陆
发表于 2010-9-7 12:50:05
|
显示全部楼层
多谢斑竹。。。  |
|
|
|
|
|
|
|
|