title: How to rename file when uploading them to server with Angular?
body: <p>I have a question about angular upload files, how I can rename files before upload? I need to give similar names to these files.
  I hear about .rename method but when I try to use it, it doesn't work. 
  How can I do that?</p>
  
  <p>This is my Directive </p>
  
  <pre><code>  .directive('fileModel', ['$parse', function($parse) {
  return {
      restrict: 'A',
      link: function(scope, element, attrs) {
          element.bind('change', function() {
              console.log('from directive', scope.$apply())
              $parse(attrs.fileModel)
                  .assign(scope, element[0].files)
              scope.$apply();
  
          });
      }
  };
  </code></pre>
  
  <p>}])</p>
  
  <p>This is my Controller</p>
  
  <pre><code>$scope.uploadFile = function(files) {
  var fd = new FormData();
  angular.forEach(this.files, function(file) {
  
      fd.append('avatar', file);
  });
  $http.post('http://hannation.me/api/userplus/avatar_upload/?key=57f211a0354d7&amp;cookie=' + $localStorage.currentUser.cookie, fd, {
      transformRequest: angular.identity,
      headers: {
          'Content-Type': undefined
      }
  }).success(function(d) {
      console.log(d);
      AuthService.getUserGravatar().then(function(data) {
          console.log(data);
          $scope.avatar = data;
      })
  })
  </code></pre>
  
  <p>}</p>