Cordova FileTransfer plugin options are empty on Android

I have a Cordova app for iOS that I am currently updating to support Android. I have most of the problems, but the FileTransfer plugin does not include FileUploadOptions.paramsin the request. Everything works fine on iOS. With Android, the request is sent and everything looks fine, except that the request that reaches the server has no form fields.

I set a breakpoint just before the method call upload, and the object options.paramslooks right.

I am testing Android 4.4.3, Cordova 3.5 and the FileTransfer 0.4.4 plugin. The server works with Apache and has SSL.

Here is my code:

var options = new FileUploadOptions();
options.chunkedMode = false;
options.mimeType = 'audio/mp4';
options.fileKey = 'file';
options.fileName = filename;
options.params = {
    'siteId': siteId,
    'name': nameFld.getValue(),
    'date': sqlDate,
    'length': Math.round(storyLength)
};
options.headers={'Authorize': token};

var ft = new FileTransfer();
ft.upload(path, url, uploadSuccess, uploadFail, options);

I found the same problem here, with no answer: PhoneTap file upload does not pass POST parameters

UPDATE: : https://issues.apache.org/jira/browse/CB-7171

+4
3

; , , . - Android .

JavaScript . Dalvik, .

+2

option.headers:

options.headers = {
    Connection: "close"
}

Phonegap File : 3 FileTransfer

+3

I can confirm that I have the same problem with the latest versions as you indicated. Apparently one solution is to use jquery.fileupload. I have not tried it yet. But, publish if it is successful.!

-1
source

All Articles