I\'m getting an image upload, or from the camera in an Angular app:
You could use Daniel Afarid's Angular File Upload
Controller
$scope.selectedFiles = [];
$scope.dataUrls = [];
$scope.model = 'test model';
$scope.onImageSelect = function($files) {
$scope.selectedFiles['image'] = $files[0];
var $file = $files[0];
if (window.FileReader && $file.type.indexOf('image') > -1) {
var fileReader = new FileReader();
fileReader.readAsDataURL($files[0]);
fileReader.onload = function(e) {
$timeout(function() {
$scope.dataUrls['image'] = e.target.result;
});
}
}
}
$scope.save_image = function(){
$upload.upload({
data:$scope.model,
url: 'the/url',
file: $scope.selectedFiles['image']
}).then(//success and error callbacks);
}
View
<form enctype="multipart/form-data" class="form-horizontal">
<input type="file" ng-file-select="onImageSelect($files)">
<br />
<img ng-show="dataUrls['image']" ng-src="{{dataUrls['image']}}">
<button ng-click="save_image()"></button>
</form>