I've run into an issue that is very similar to this post:
http://www.telerik.com/forums/code-3-upload-error-on-android-4-3-when-uploading-to-s3
We are developing an iPad app that requires us to take pictures and upload them to Cloudinary, using their REST API. In order to accomplish this, we are trying to leverage Cordova's Camera and FileTransfer functionality. Taking the picture works okay, but whenever we try upload the files we are immediately getting a FileTransferError with code 3, just like the post described above. We have verified that the request is never actually issued. This problem exists on both the simulator using the native Windows client and on the iPad itself. According to the docs, the FileTransfer plugin is supported on the simulator for the windows client, so that's our starting point.
Here's what we're doing:
var
ft =
new
FileTransfer();
var
options =
new
FileUploadOptions();
var
params = {
timestamp: ts,
signature: signature,
api_key: apiKey
};
options.params = params;
options.fileKey =
"file"
;
options.fileName = fileURI.substr(fileURI.lastIndexOf(
'/'
) + 1);
options.mimeType =
"image/jpeg"
;
options.chunkedMode =
false
;
options.headers = {
Connection:
"close"
};
ft.upload(fileURI, encodeURI(CLOUDINARY_URL), successCallback, failureCallback, options,
false
);
No matter what I try to modify, I always seem to get a FileTransferError that looks like the following:
{
body:
null
,
code: 3,
exception:
null
,
http_status: 408,
source:
"<image source>"
}
I've tried everything I've found around the web regarding similar issues, including:
- Changing the destinationType on the camera.getPicture call to FILE_URI
- Adding our removing the Connection header
- Setting trustAllHosts to true and false
- Setting chunkedMode to both true and false
The next thing I will try is to get my FileTransfer plugin updated to version 0.5.0 (my project has 0.4.8) but as far as I can tell there were some known bugs with this stuff that supposedly got fixed many versions ago so I'm doubtful this will work.