Phonegap Android Filetransfer Error Code 3

岁酱吖の 提交于 2019-12-05 11:05:50
Braunson

You can try either of these:

Set android:debuggable="true" in the tag of your AndroidManifest.xml file.

Set instead of just the * as it's recommended in the comments section as follows:

<!-- <access origin="https://example.com" /> allow any secure requests to example.com -->
<!-- <access origin="https://example.com" subdomains="true" /> such as above, but including subdomains, such as www -->
<!-- <access origin=".*"/> Allow all domains, suggested development use only -->

From; https://stackoverflow.com/a/12011782/610880

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);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!