I have an existing web service that handles user input of a photo (as well as some other number and text data). The photo is captured via the input tag:
Turns out it was a simple fix:
navigator.camera.getPicture(
function(imgData) {
var fd = new FormData();
var reader;
var imgBlob;
window.resolveLocalFileSystemURL(imgData, function(fileEntry) {
fileEntry.file(function(file) {
reader = new FileReader();
reader.onloadend = function(e) {
imgBlob = new Blob([ this.result ], { type: "image/jpeg" } );
window.__file = imgBlob; // PLACE THE FILE ASSIGNMENT HERE AFTER THE READER HAS INGESTED THE FILE BYTES
};
reader.readAsArrayBuffer(file);
// window.__file = imgBlob; // FILE ASSIGNMENT USED TO BE HERE
}, function(e){
console.log('error with photo file');
});
}, function(e){
console.log('error with photo file');
});
},
function() {
alert('Error taking picture', 'Error');
},
options);
};