Hello I am trying to crop my image and upload a image using ng-file upload in angularjs.
I am getting canvas data after cropping. Then how to covert that data to file and upload to server using ng file upload.
Thanks in advance.
Try to discover this example. I think it's can be help you.
$scope.upload = function (dataUrl) {
Upload.upload({
url: 'https://angular-file-upload-cors-srv.appspot.com/upload',
data: {
file: Upload.dataUrltoBlob(dataUrl)
},
}).then(function (response) {
$timeout(function () {
$scope.result = response.data;
});
}, function (response) {
if (response.status > 0) $scope.errorMsg = response.status
+ ': ' + response.data;
}, function (evt) {
$scope.progress = parseInt(100.0 * evt.loaded / evt.total);
});
}