I try to upload image to server, but have some troubles...
i have such html:
<form role="form" enctype="multipart/form-data">
<input type="file" class="form-control" id="photo" ng-model="news.Photo" placeholder="Link" />
<button ng-click="addImage()" class="btn btn-primary">Add</button>
</form>
and such code in .js:
$scope.addImage = function(){
$http.post(settings.apiBaseUri + "/files", $scope.news.Photo,
{headers: {'Content-Type': 'multipart/form-data'}})
.success(function (response) {
$scope.clearEvent();
})
.error(function (err, status) {
console.log('operation failed, status: ' + status);
});
};
what i do wrong? maybe it's not server problem, but my, maybe i write something bad?
Aucun commentaire:
Enregistrer un commentaire