Phonegap : FileTransfer.upload() fails on Android

前端 未结 2 1847
无人及你
无人及你 2020-12-10 18:40

I\'m currently trying to upload a picture to a server with the FileTransfer.upload() method of PhoneGap. It works fine on the iPhone Simulator over Wifi, but fails on an And

相关标签:
2条回答
  • 2020-12-10 19:20

    Error code 3 is a connection error. Recently we made chunked mode the default for uploading on Android. Try setting your options object to have a chunked mode that is false.

    var options = FileUploadOptions();
    options.chunkedMode = false;
    
    0 讨论(0)
  • 2020-12-10 19:38

    Today, I tried Simon MacDonald's answer and it worked, so for those who have the same problem. It's certificate related and can be solved simply by adding a 'true' parameter at the end of the upload() function like below :

    upload(filePath, server, successCallback, errorCallback, options, true);
    

    Thank you !

    PS: That extra "true" at the end tells upload to accept self signed certs.

    0 讨论(0)
提交回复
热议问题