danialfarid / ng-file-upload

Lightweight Angular directive to upload files with optional FileAPI shim for cross browser support
MIT License
7.87k stars 1.6k forks source link

Error 403(forbidden) #2052

Open simonebrunori opened 6 years ago

simonebrunori commented 6 years ago

Hi, I am new with angularjs, why I am getting error 403 forbidden? The directory in the server has got all the permissions. Error: angular.js:10765 GET http://...../ 403 (Forbidden)

Controller:

 $scope.submit = function() {
      if ($scope.form.file.$valid && $scope.file) {
        console.log($scope.file);
        $scope.save($scope.file);
      }
    };
$scope.save = function (file) {
      console.log('conferma');
      Upload.upload({
        url: '/uix/circolari/uploadCircolari',
        data: {file: file}
      }).then(function (resp) {
        console.log('Success ' + resp.config.data.file.name + 'uploaded. Response: ' + resp.data);
      }, function (resp) {
        console.log('Error status: ' + resp.status);
      }, function (evt) {
        var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
        console.log('progress: ' + progressPercentage + '% ' + evt.config.data.file.name);
      });
    };

Thanks for the help.