Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 Flex文件I/O错误2038-File.upload在移动IOS上失败_Actionscript 3_Apache Flex_File Upload_Flex3_Flex4.5 - Fatal编程技术网

Actionscript 3 Flex文件I/O错误2038-File.upload在移动IOS上失败

Actionscript 3 Flex文件I/O错误2038-File.upload在移动IOS上失败,actionscript-3,apache-flex,file-upload,flex3,flex4.5,Actionscript 3,Apache Flex,File Upload,Flex3,Flex4.5,我需要用Flex开发的IOS应用程序将xml文件上传到服务器。我得到一份工作 Flex文件I/O错误2038。这是一个非常普通的i/o错误,没有提供任何进一步的细节来帮助我追踪根本问题。在Windows上调试应用程序时一切都进行得很顺利,只有在我在apple Air平板电脑上调试应用程序时才会发生这种情况 我偶然发现了一个类似的帖子,但老实说,我没能使用这个信息。我的平板电脑似乎正在破坏URL。我没有做过任何交通监控,但我可以发誓,甚至没有打过电话 代码如下: var f:File = new

我需要用Flex开发的IOS应用程序将xml文件上传到服务器。我得到一份工作 Flex文件I/O错误2038。这是一个非常普通的i/o错误,没有提供任何进一步的细节来帮助我追踪根本问题。在Windows上调试应用程序时一切都进行得很顺利,只有在我在apple Air平板电脑上调试应用程序时才会发生这种情况

我偶然发现了一个类似的帖子,但老实说,我没能使用这个信息。我的平板电脑似乎正在破坏URL。我没有做过任何交通监控,但我可以发誓,甚至没有打过电话

代码如下:

 var f:File = new File('app-storage:/Output_WithAllInfo.xml');
 var request:URLRequest = new URLRequest();
 request.url = http://myHost/JsonServer/?country=DE&language=deu&operationtype=custom&select=[{\"item\":\"*\"}]&sessionid="+sessionId+"&custom=[{\"package\":\"eu.app\",\"name\":\"syncInUpload\",\"data\":{\"nxpkeyProcessId\":"+processId+",\"nxpkeyProcessDefinitionId\":null,\"xml\":null}}]";
 request.method = URLRequestMethod.POST;
 f.upload(request,"xml", false);
请求参数包括:

authenticate:true
cacheResponse:true
 contentType:null
data:null
digest:null
followRedirects:true
idleTimeout:0
manageCookies:true
method:"POST"
requestHeaders:[] length:0
url:http://domain/JsonServer/?country=DE&language=deu&operationtype=custom&select=[{"item":"*"}]&sessionid=b9f33c5e-0445-49d3-ab5c-a335229596cf&custom=[{"package":"eu.app","name":"syncInUpload","data":{"nxpkeyProcessId":606,"nxpkeyProcessDefinitionId":null,"xml":null}}]
useCache:true
userAgent:"Mozilla/5.0 (iOS; U; de) AppleWebKit/533.19.4 (KHTML, like Gecko) AdobeAIR/3.7"
我得到了一个错误:

 Error #2038: File I/O Error. URL: http://domain/JsonServer/?country=DE&language=deu&operationtype=custom&select=[{"item":"*"}]&sessionid=b9f33c5e-0445-49d3-ab5c-a335229596cf&custom=[{"package":"eu.app","name":"syncInUpload","data":{"nxpkeyProcessId":606,"nxpkeyProcessDefinitionId":null,"xml":null}}]
我真的需要帮助。。。 谢谢

我应该试试这样的东西吗:

 var req:URLRequest=new URLRequest("url");
req.method=URLRequestMethod.POST;
var postData:URLVariables=new URLVariables();
postData.country= 'DE';
postData.language='deu';
postData.operationtype= 'custom';select='[{\"item\":\"*\"}]';
sessionid=e.session;
custom='[{\"package\":\‌​"eu.app\",\"name\":\"syncInUpload\",\"data\":\"nxpkeyProcessId\":606,\"nxpkeyProc‌essDefinitionId\":null,\"xml\":null}}];
req.data = postData;
var loader:URLLoader = new URLLoader();
loader.dataFormat=URLLoaderDataFormat.BINARY;
loader.addEventListener‌​(Event.COMPLETE,
loader_complete);
loader.load(req);

尝试使用UrlVariables类

我的问题的解决方案是对URL进行编码,我将代码更改为:

var f:File = new File('app-storage:/Output_WithAllInfo.xml');
var request:URLRequest = new URLRequest();
var jsonParams:String = "/JsonServer/?country="+e.country+"&language="+e.lang+"&operationtype=custom&select=[{\"item\":\"*\"}]&sessionid="+e.sessionId+"&custom=[{\"package\":\"eu.app\",\"name\":\"syncInUpload\",\"data\":{\"nxpkeyProcessId\":"+e.processId+",\"nxpkeyProcessDefinitionId\":null,\"xml\":null}}]";
request.url = GlobalCGStaticVars.ipAddressJsonCalls+htmlencodeSpecial(jsonParams);
request.url = 'http://myHost'+htmlencodeSpecial(jsonParams);
request.method = URLRequestMethod.POST;
f.upload(request,"xml", false);


protected function htmlencodeSpecial(str:String):String
    {
        var result:String = '';
        for (var i:int=0 ; i< str.length; i++)
        {
            var unicode:String = '';

            if(str.charAt(i)=='{')
                unicode = '%7B';
            else if(str.charAt(i)=='[')
                unicode = '%5B';
            else if(str.charAt(i)==':')
                unicode = '%3A';
            else if(str.charAt(i)==']')
                unicode = '%5D';
            else if(str.charAt(i)=='}')
                unicode = '%7D';
            else if(str.charAt(i)=='"')
                unicode = '%22';
            else 
                unicode =  str.charAt(i);


            result += unicode;
        }
        return result;
    }

您能打开文件并将XML放入文本区域吗?此外,还应考虑使用File.applicationStorageDirectory.resolvePathOutput_和allinfo.xml;若要打开您的文件。@Dave是的,请将您提到的所有必需参数放入postData中,这样转义由运行时完成,您不必担心参数的编码会导致问题。编辑您的问题并添加您尝试过的代码,不要在注释中添加代码,只需提及您更新了问题我上传的xml文件非常大,其中包含10个编码图像。后端的人说,如果我以byteArray的形式发送,它太长了。@Dave发送一个小文件,看看是否有效,我不确定你是否将自定义对象分配给postData,我想我帮不上什么忙,也许可以尝试自定义一个对象或数组而不是字符串,让UrlVariables来完成编码工作。如果您可以访问服务器端代码,也许您可以找到确切的错误