您好我正在尝试将图片上传到服务器,但我收到错误,下面是我的代码
Html code:
<img ng-src="{{image_source}}" class="img-responsive" alt="gallery image">
<button type="button" name="yes" class="primary-button" ng-click="tack()">Yes</button>
和控制器:
$scope.tack = function(x) {
var imagedata={
'fileData':$scope.image_source
}
console.log(imagedata)
imageUploadService.uploadImage(imagedata).success(function(response) {
$scope.image=response;
console.log($scope.image)
})
}
服务是:
app.service('imageUploadService', function ($http,BaseUrl) {
var Service = function(){
this.uploadImage = function (imagedata) {
return $http.post(BaseUrl.url+'eventImageUpload',imagedata);
};
}
return new Service();
})
但我无法上传图片PLZ建议解决方案