zoukankan      html  css  js  c++  java
  • web开发1fckeditor部署报错:The server didn't reply with a proper XML data.

    在部署fckeditor的时候可能遇到各种各样的问题,很容易就在网上搜到答案的可能大家不会在乎,我遇到的纠结了很长时间在搞定,走了一些弯路。

    先看看问题。部署好之后上传图片的时候浏览本地文件的时候出错。火狐错误界面如下图1

    图1

    这个图给的信息是假象,通过信息可以找到报错的代码\fckeditor\editor\filemanager\browser\default\js\fckxml.js,

    代码如下:

    FCKXml.prototype.LoadUrl = function( urlToCall, asyncFunctionPointer )
    {
        var oFCKXml = this ;
    
        var bAsync = ( typeof(asyncFunctionPointer) == 'function' ) ;
    
        var oXmlHttp = this.GetHttpRequest() ;
    
        oXmlHttp.open( "GET", urlToCall, bAsync ) ;
    
        if ( bAsync )
        {
            oXmlHttp.onreadystatechange = function()
            {
                if ( oXmlHttp.readyState == 4 )
                {
                    var oXml ;
                    try
                    {
                        // this is the same test for an FF2 bug as in fckxml_gecko.js
                        // but we've moved the responseXML assignment into the try{}
                        // so we don't even have to check the return status codes.
                        var test = oXmlHttp.responseXML.firstChild ;
                        oXml = oXmlHttp.responseXML ;
                    }
                    catch ( e )
                    {
                        try
                        {
                            oXml = (new DOMParser()).parseFromString( oXmlHttp.responseText, 'text/xml' ) ;
                        }
                        catch ( e ) {}
                    }
    
                    if ( !oXml || !oXml.firstChild || oXml.firstChild.nodeName == 'parsererror' )
                    {
                        alert( 'The server didn\'t send back a proper XML response. Please contact your system administrator.\n\n' +
                                'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')\n\n' +
                                'Requested URL:\n' + urlToCall + '\n\n' +
                                'Response text:\n' + oXmlHttp.responseText ) ;
                        return ;
                    }
    
                    oFCKXml.DOMDocument = oXml ;
                    asyncFunctionPointer( oFCKXml ) ;
                }
            }
        }
    
        oXmlHttp.send( null ) ;
    
        if ( ! bAsync )
        {
            if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
                this.DOMDocument = oXmlHttp.responseXML ;
            else
            {
                alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ;
            }
        }
    }

    在网上很多人在这段代码里面找原因,围绕着这一段代码修改,并且解决了问题 ,但是很不幸,除了我之外,我也在这段代码里面缝缝补补,最后问题还是存在。

    在IE浏览器里面报错更加详细,其实在火狐里面如果跟进去也可以看到这个详细的报错信息,如下图2。

    图2

    最关键的信息是:Error calling [msvcrt.dll]:_wnkdir(c:\input\wwwroot\fckfiles),error code:-1
    注意到fckfiles是我自己新建的一个文件夹,放在和fckeditor平行的一个目录下,怎么会出现在“c:\input\wwwroot\fckfiles”这样的一个路径下呢,很明显是配置文件里面配置上传图片文件的目录时出错了。

    将<add key="FCKeditor:UserFilesPath" value="/fckfiles/"/>修改为<add key="FCKeditor:UserFilesPath" value="~/fckfiles/"/>最后解决问题。

    作者:Tyler Ning
    出处:http://www.cnblogs.com/tylerdonet/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,如有问题,请微信联系冬天里的一把火

  • 相关阅读:
    第六日会议博客
    第五日会议博客
    第四日会议博客
    第三日会议博客
    第二日会议博客
    第一日会议博客
    Alpha总结展望——前事不忘后事之师
    请坐,我们是专业团队——Alpha冲刺
    微信小程序测试总结
    WeChair项目Beta冲刺(4/10)
  • 原文地址:https://www.cnblogs.com/tylerdonet/p/2716010.html
Copyright © 2011-2022 走看看