I'm trying to avoid handling the image uploading for an Ionic app that I'm creating. The idea that I had was to directly take a picture and let the client upload it to my Amazon S3.
However, I'm confused as to how I can go about this. With the code that I currently have:
var options = {saveToPhotoAlbum: false, targetWidth: 450, targetHeight: 300};
$scope.getPhoto = function() {
Camera.getPicture().then(function(imageURI) {
$rootScope.image_url = imageURI; // this contains a URL
console.log(imageURI);
}, function(err) {
console.err(err);
});
};
The URL that i get back here is something like:
file:///storage/emulated/0/Android/data/com.ionicframework.app3000857/cache/1419546238582.jpg
How would I go about uploading this to S3?
You can use the Amazon's javascript SDK to achieve that http://aws.amazon.com/sdk-for-browser/ otherwise, you will need to use a backend server like python with boto library.
Following is a coding example of the same: http://embed.plnkr.co/2dox82/