Phonegap:Android 上的 FileTransfer.upload() 失败 [英] Phonegap : FileTransfer.upload() fails on Android

查看:27
本文介绍了Phonegap:Android 上的 FileTransfer.upload() 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用 PhoneGap 的 FileTransfer.upload() 方法将图片上传到服务器.它在通过 Wifi 的 iPhone 模拟器上运行良好,但在通过 3G 或 Wifi 的 Android 手机上失败.

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 Android phone over 3G or Wifi.

alert(error.code) 返回 '3' 但我找不到这个错误代码是什么.

alert(error.code) returns '3' but I couldnt find out what this error code is.

有没有人偶然发现了同样的问题并设法解决了它?请帮忙.

Did anybody stumbled upon the same problem and managed to solve it ? Please help.

推荐答案

今天,我尝试了 Simon MacDonald 的答案,它奏效了,所以对于那些有同样问题的人来说.它与证书相关,只需在 upload() 函数末尾添加一个true"参数即可解决,如下所示:

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

谢谢!

PS:最后额外的真"告诉上传接受自签名证书.

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

这篇关于Phonegap:Android 上的 FileTransfer.upload() 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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