0

我对使用 angularJS 上传图像有疑问。

我正在使用此代码上传图片http://jsfiddle.net/sc1qnw4n/,这是某人已经制作的代码。

$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);
    });
}

但是当我按下上传图片时,我得到了这个:

错误无法发布 /imageURL

有没有人有同样的问题?谢谢 :)

4

0 回答 0