title: Getting 404 error while trying to upload a file from angular js
body: <p>HI I am using apache tomact server. I want to upload a file from my angular js HTML application.
   How can I solve this?
  Code is :</p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
        &lt;title&gt;AngularJS File Upoad Example with $http and FormData&lt;/title&gt;
        &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
  
      &lt;body ng-app="fupApp"&gt;
          &lt;div ng-controller="fupController"&gt;
  
              &lt;input type="file" id="file1" name="file" multiple
                  ng-files="getTheFiles($files)" /&gt;
  
              &lt;input type="button" ng-click="uploadFiles()" value="Upload" /&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  
      &lt;script&gt;
          angular.module('fupApp', [])
              .directive('ngFiles', ['$parse', function ($parse) {
  
                  function fn_link(scope, element, attrs) {
                      var onChange = $parse(attrs.ngFiles);
                      element.on('change', function (event) {
                          onChange(scope, { $files: event.target.files });
                      });
                  };
  
                  return {
                      link: fn_link
                  }
              } ])
              .controller('fupController', function ($scope, $http) {
  
                  var formdata = new FormData();
                  $scope.getTheFiles = function ($files) {
                      angular.forEach($files, function (value, key) {
                          formdata.append(key, value);
                      });
                  };
  
                  // NOW UPLOAD THE FILES.
                  $scope.uploadFiles = function () {
  
                      var request = {
                          method: 'POST',
                          url: '/fileUploadFolder',
                          data: formdata,
                          headers: {
                              'Content-Type': undefined
                          }
                      };
  
                      // SEND THE FILES.
                      $http(request)
                          .success(function (d) {
                              alert(d);
                          })
                          .error(function () {
                          });
                  }
              });
      &lt;/script&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>Here the folder:fileUploadFolder is inside webapps folder. But still i get the error 404 folder doesnt exist. Can some one please help</p>