0

i've been going from page to page all over the internet trying to find a simple and recommended way of uploading a single file in angularjs, so far i have found none, what i want is to be able to do something like this:

<input type="file" ng-model="file" id="form.file" />
<input type="text" ng-model="name" id="form.name" />

Then in my controller/service i have a function that posts all my form data:

SomeRandomService.save = function($scope.form) {

    return $http
        .post('/api/v1/some/random/url/', $scope.form)

};

Is this so difficult in angular? I am a newbie to angular so i can't even understand some of the solutions i have found online.

Is there something way more simpler? A plugin or service or directive that can do this for me?

user3718908x100
  • 7,939
  • 15
  • 64
  • 123
  • Check the search function first :) See http://stackoverflow.com/questions/18571001/file-upload-using-angularjs – Just-a-random-guy Jul 24 '15 at 14:32
  • Have already seen that, the issue i have with those is that they either do not show how to post a file along with text input or they have cross browser compatibility problems or they use some complex alien like code that i can't even understand. I did find one which seemed to be what i was looking for but they referenced a plugin without adding a link so i dunno how to get it and implement their solution. – user3718908x100 Jul 24 '15 at 15:24
  • The post i am referring to is this: http://stackoverflow.com/questions/24443246/angularjs-how-to-upload-multipart-form-data-and-a-file – user3718908x100 Jul 24 '15 at 15:30

0 Answers0