PhoneGap的Andr​​oid的文件传输错误code 3 [英] Phonegap Android Filetransfer Error Code 3

查看:309
本文介绍了PhoneGap的Andr​​oid的文件传输错误code 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的移动应用程序为Android,它采用戴夫约翰逊的Facebook连接插件(<一href="https://github.com/davejohnson/phonegap-plugin-facebook-connect">https://github.com/davejohnson/phoneg...),相机和文件传输,基本上用户点击一个按钮,拍摄照片(手机相机开始,用户拍照),那么这张照片被上传到服务器上。问题是,第一次一切都很好,但是当我再次按下按钮拍摄第二张照片,照片不能上传到服务器,并返回的错误是从文件传输 - 错误code 3

I am working on mobile application for Android, which uses Dave Johnson's Facebook Connect Plugin (https://github.com/davejohnson/phoneg...), Camera and FileTransfer. Basically the user clicks on a button to Take a Photo ( The Phone Camera Starts, the user takes a photo ), then this photo is uploaded to a server. The problem is that first time everything is fine, but when I hit the button again to shoot a second photo, the photo can't be uploaded to a server and the returned error is from FileTransfer - Error Code 3.

我已经设置options.chunkedMode = FALSE;这并没有帮助。

I have set options.chunkedMode = false; This doesn't help.

我知道,这是一个连接错误,我白名单是我上传的图片在/res/xml/cordova.xml文件的域。我在网上搜索了很多找到一个有效的解决方案还有其他人抱怨这个,但没有提供任何可行的解决方案。我使用的是科尔多瓦1.8.1(我还与1.8.0,1.7.0,1.6.1,1.5.0测试)。我测试了的PhoneGap的例如1.9.0新版本,但不能建立项目 - Facebook的插件并没有与此版本的PhoneGap的工作。我测试使用模拟器的Andr​​oid 4.1(API 16)。我尝试不同的东西,使其工作,而我一直在寻找在细节的记录,但我不能使它工作。我试图找到一个解决方案,因为它是非常重要的,请帮我解决这个问题。感谢您提前为您解答。

I know that this is a connection error, I whitelisted the domain that I'm uploading the picture to in the /res/xml/cordova.xml file. I searched the web a lot to find a working solution there are other people complaining about this, but there is no working solution provided. I'm using Cordova 1.8.1 ( I also tested with 1.8.0, 1.7.0, 1.6.1, 1.5.0 ). I tested with newer versions of Phonegap for example 1.9.0 but can't build the project - the facebook plugin doesn't work with this version of Phonegap. I am testing using Emulator Android 4.1 (API 16). I tried different things to make it work while I was looking at the logs in details, but I couldn't make it work. I'm trying to find a solution, because it is very important, please help me solve this issue. Thank you in advance for you answers.

推荐答案

这是在PhoneGap的库中的不固定的错误,因为没有错误修正,我不得不把它通过我的工作解决(基本上重新上传上每隔失败):

This is an unfixed bug in the phonegap library, since there were no bug fixes, i had to get it work by my work around (Basically reupload on every alternate failure):

ft.upload(path,
          encodeURI("http://yourdomain.com/upload.php"),
            function(result) {
                alert("Uploaded");
            },
            function(error) {
        ft.upload(path,
        encodeURI("http://yourdomain.com/upload.php"),
        function(result) {
                alert("Uploaded");                  
        },
        function(error) {
            alert("Error uploading image");
        },
        { fileName: name, fileKey: "file", mimeType: "image/jpeg", chunkedMode: false }, true);     
                },
                { fileName: name, fileKey: "file", mimeType: "image/jpeg", chunkedMode: false }, true);

这篇关于PhoneGap的Andr​​oid的文件传输错误code 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆