I am using ionic and the ngCordova camera plugin to invoke my camera and I am getting my image in base64 formate I dont need to save the image but I need the Image to be sent to serve not as base64. I need to send it as a file formate is there any way to send the image as file to serve my backed is c#.
This is my html looks like
<img ng-show="imgURI !== undefined" ng-src="{{imgURI}}">
<img ng-show="imgURI === undefined" ng-src="http://placehold.it/250x250">
<button class="button" ng-click="takePicture()">Take Picture</button>
My app.js file
$scope.takePicture = function(){
var options = {
quality: 50,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.CAMERA,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 250,
targetHeight: 250,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false,
correctOrientation:true
};
$cordovaCamera.getPicture(options).then(function(imageData) {
console.log(imageData);
$scope.imgURI = "data:image/jpeg;base64," + imageData;
}, function(err) {
// error
});
};
}, false);
In my imageData i am have the base64 value is there a way to convert $scope.imgURI into file so that i will be able to send my image to serve.