Resolution: Not A Problem
Affects Version/s: 4.3.1
Fix Version/s: None
Cordova iOS, Android.
Cordova File System Plugin: 4.3.1
Cordova iOS: 4.3.1
Cordova Android: 6.0.0
Desktop OS: OS X 10.12.1
Desktop Safari: 10.0.1
AWS S3 SDK is documented at:
On both Android and iOS, using the Cordova File System plugin, and in OS X Safari using the File Input HTML tag, my test app successfully retrieves a File object in every case from the local file system.
In the Cordova apps, both iOS and Android, the file seems to upload correctly (no errors), but the resulting (correctly named) file in the bucket contains only the 15-byte text string "[object Object]".
The app uses the same HTML and JS source files in all three cases; after creating the File object the code is identical, and because they run from the same HTML page, the meta information is also the same.
Because the S3 API upload method supports multipart uploads, it invokes the File.slice method on the File before passing it to xhr.send. In the desktop Safari implementation of the File object, the slice method returns a Blob object. In the Cordova implementation (as documented in the source code at line 47 of File.js) it returns another File object.
Tracing through to the xhr.send function in the S3 API, the desktop version delivers a Blob as the argument to xhr.send(), and the file is uploaded correctly. The Cordova versions deliver a File as the argument to xhr.send(), and the uploads fail.
Although the File object in desktop Safari is an instanceof Blob, the Cordova File object is not an instanceof Blob, which might explain why xhr.send can't cope with it.
The documentation here (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send) indicates that xhr.send can handle a Blob, but doesn't mention a File.