0

I have question about upload-ing images with angularJS.

I'm using this code for upload image http://jsfiddle.net/sc1qnw4n/, that's code already made by someone.

$scope.uploadImage = function() {
  var fd = new FormData();
  var imgBlob = dataURItoBlob($scope.uploadme);
  fd.append('file', imgBlob);
  $http.post(
      'imageURL',
      fd, {
        transformRequest: angular.identity,
        headers: {
          'Content-Type': undefined
        }
      }
    )
    .success(function(response) {
      console.log('success', response);
    })
    .error(function(response) {
      console.log('error', response);
    });
}

But when I press upload image i got this:

error Cannot POST /imageURL

Has anyone had the same problem? Thank you :)

Nix
  • 57,072
  • 29
  • 149
  • 198
Iris
  • 1
  • 2

0 Answers0