Phonegap 的 FileTransfer.upload() 在 Android 上抛出错误代码 3 [英] Phonegap's FileTransfer.upload() throwing error code 3 on Android
问题描述
我正在将图片上传到服务器.我能够使用 iOS 成功上传图像,但是当我尝试使用 android 时,我得到错误代码 3.目前使用 phonegap cordova 1.8.1.
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 phonegap cordova 1.8.1.
我已经尝试在参数中添加 true
I already tried adding true to the parameters
upload(filePath, server, successCallback, errorCallback, options, **true**);
并添加这个
options.chunkedMode = false;
我的 AndroidManifest 文件包含:
My AndroidManifest file contains:
<uses-permission android:name="android.permission.INTERNET" />
我的 cordova.xml 文件包含:
My cordova.xml file contains:
<access origin="*"/>
我错过了什么吗?
谢谢
推荐答案
问题可能不在Phonegap.如果服务器是基于 Windows 的服务器,请尝试使用另一台服务器.另外,不要忘记添加这些行:
The issue probably is not in Phonegap. if the server is a Windows based server, try using another server. Also, don´t forget to add these lines:
var options = new FileUploadOptions();
options.chunkedMode = false;
options.headers = {
Connection: "close"
};
这篇关于Phonegap 的 FileTransfer.upload() 在 Android 上抛出错误代码 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!