代码改变世界

使用FCKeditor_2.6.3版本有关上传图片问题解决

2008-10-25 16:39  每天看看  阅读(3126)  评论(5编辑  收藏  举报

使FCKeditor_2.6.3版本有关上传图片问题解决

问题:提示This connector is disabled

解决:
在fckeditor\editor\filemanager\connectors\aspx目录下面有一个 config.ascx 用户控件。打开它,我们可以看到有一个:private bool CheckAuthentication()的方法。
private bool CheckAuthentication()
 {
  // WARNING : DO NOT simply return "true". By doing so, you are allowing
  // "anyone" to upload and list the files in your server. You must implement
  // some kind of session validation here. Even something very simple as...
  //
  //  return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
  //
  // ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
  // user logs in your system.
 
  return false;
  }
默认是返回false的,返回true就可以了。不要轻易的返回true,要不然任何人都可以上传文件到你的服务器。可以在这里验证session的值来判断用户是否可以上传文件。
 

问题:FCKEditor 图片上传一直显示进度条的问题


解决:

很多博主介绍配置FCKeditor的目录时都是这样写的,我不知道是不是大家互相复制的关系

<appSettings>
    <add key="FCKeditor:BasePath" value="~/FCKeditor/"/>
    <!--FCKeditor基本文件目录-->
    <add key="FCKeditor:UserFilesPath" value="/UserFiles/"/>
    <!--文件上传目录-->
  </appSettings>

大家看一下上面两个配置有什么区别没有,"~/FCKeditor/"比"/UserFiles/"前面多了符号“~”。

在“/UserFiles/”前面加上“~”符号就可以了。

这个错误还会导致下面的问题:在单击浏览服务器按钮是提示:未能映射路径“/Files/image/”,具体提示如下:

==========================================================================================

---------------------------
Microsoft Internet Explorer
---------------------------
The server didn't send back a proper XML response. Please contact your system administrator.

XML request error: Internal Server Error (500)

Requested URL:
http://localhost:7958/FCKeditorTest/FCKeditor/editor/filemanager/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=%2F&uuid=1224920141937

Response text:
<html>

    <head>

        <title>未能映射路径“/UserFiles/image/”。</title>

        <style>

         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}

         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}

         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}

         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

         pre {font-family:"Lucida Console";font-size: .9em}

         .marker {font-weight: bold; color: black;text-decoration: none;}

         .version {color: gray;}

         .error {margin-bottom: 10px;}

         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

        </style>

    </head>

 

    <body bgcolor="white">

 

            <span><H1>“/FCKeditorTest”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1>

 

            <h2> <i>未能映射路径“/UserFiles/image/”。</i> </h2></span>

 

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

 

            <b> 说明: </b>执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

 

            <br><br>

 

            <b> 异常详细信息: </b>System.InvalidOperationException: 未能映射路径“/UserFiles/image/”。<br><br>

 

            <b>源错误:</b> <br><br>

 

            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code>

 

执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。</code>

 

                  </td>

               </tr>

            </table>

 

            <br>

 

            <b>堆栈跟踪:</b> <br><br>

 

            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code><pre>

 

[InvalidOperationException: 未能映射路径“/UserFiles/image/”。]

   System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +615

   System.Web.VirtualPath.MapPathInternal() +29

   System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping) +125

   System.Web.HttpServerUtility.MapPath(String path) +58

   FredCK.FCKeditorV2.FileBrowser.TypeConfig.GetFilesDirectory() +63

   FredCK.FCKeditorV2.FileBrowser.FileWorkerBase.ServerMapFolder(String resourceType, String folderPath, Boolean isQuickUpload) +37

   FredCK.FCKeditorV2.FileBrowser.Connector.GetFolders(XmlNode connectorNode, String resourceType, String currentFolder) +21

   FredCK.FCKeditorV2.FileBrowser.Connector.OnLoad(EventArgs e) +708

   System.Web.UI.Control.LoadRecursive() +49

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3743

</pre></code>

 

                  </td>

               </tr>

            </table>

 

            <br>

 

            <hr width=100% size=1 color=silver>

 

            <b>版本信息:</b>&nbsp;Microsoft .NET Framework 版本:2.0.50727.42; ASP.NET 版本:2.0.50727.42

 

            </font>

 

    </body>

</html>

<!--

[InvalidOperationException]: 未能映射路径“/UserFiles/image/”。

   在 System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull)

   在 System.Web.VirtualPath.MapPathInternal()

   在 System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping)

   在 System.Web.HttpServerUtility.MapPath(String path)

   在 FredCK.FCKeditorV2.FileBrowser.TypeConfig.GetFilesDirectory()

   在 FredCK.FCKeditorV2.FileBrowser.FileWorkerBase.ServerMapFolder(String resourceType, String folderPath, Boolean isQuickUpload)

   在 FredCK.FCKeditorV2.FileBrowser.Connector.GetFolders(XmlNode connectorNode, String resourceType, String currentFolder)

   在 FredCK.FCKeditorV2.FileBrowser.Connector.OnLoad(EventArgs e)

   在 System.Web.UI.Control.LoadRecursive()

   在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

[HttpUnhandledException]: 引发类型为“System.Web.HttpUnhandledException”的异常。

   在 System.Web.UI.Page.HandleError(Exception e)

   在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

   在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

   在 System.Web.UI.Page.ProcessRequest()

   在 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)

   在 System.Web.UI.Page.ProcessRequest(HttpContext context)

   在 ASP.fckeditor_editor_filemanager_connectors_aspx_connector_aspx.ProcessRequest(HttpContext context)

   在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

   在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

-->
---------------------------
确定  
---------------------------

============================================================================================================

以上问题都是根据测试推断出的,我并不知道源码是怎么处理的,希望高手能给予指点。

相关链接:

FCKeditor_2.6.3的安装使用方法