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

后端 未结 8 1556
离开以前
离开以前 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:28

    These are steps I used to overcome this problem:

    Added the following options:

    options.chunkedMode = false;
    options.headers = {
          Connection: "close"
       };
    

    But more important was the fact that I was using Genymotion as the emulator for testing. Uploading the image to localhost was not working because the emulator was running in a VM and localhost meant the VM's localhost and not the localhost of your web server.

    So instead of uploading to 'localhost', you should upload to:

    http://10.0.2.2 
    

    and add the following line to your config.xml:

    
    

    I tested it and its working like a charm. Took me 3 days to get this working though.

提交回复
热议问题