I'm building a dart app using Cordova. According to cordova doc , I'm using FILE_URI to retrieve the image.
I'm using 'dart:js' to call my JS script where I have
function loadPhotofromPhoneLibrary(onPhotoURISuccess,onFail) {
// Retrieve image file location from specified source
navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50,
destinationType: destinationType.FILE_URI,
sourceType: pictureSource.PHOTOLIBRARY });
}
In my dart code , how can post my image to the server from an imageURI, using HTTPRequest
void onloadPhotoFromPhoneLibrary() {
js.context.callMethod('loadPhotofromPhoneLibrary',[onPhotoURISuccess,onPhotoURIFail]);
}
void onPhotoURISuccess(imageURI) {
// TODO: Here how to post imageURI as MULTIPART_FORM_DATA to Server :( ?
}
void onPhotoURIFail(message) {
window.alert('Failed because: ' + message);
}