Phonegap's FileTransfer.upload() throwing error code 3 on Android

后端 未结 8 1502
离开以前
离开以前 2020-12-16 03:01

I am working on uploading a picture to a server. I am able to successfully upload an image using iOS but when i try on android I get the error code 3. Currently using phoneg

8条回答
  •  离开以前
    2020-12-16 03:25

    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);
    

提交回复
热议问题