I have a very simple form where users can write posts and insert a thunbnail image, the problem is that whenever i append the multipart header to the ajax request, the data doesn't get transmitted to the server. This is my ajax service:
angular.module('kadir.services', [])
.factory('cuService', function($q,$http) {
var newPost = function(data){
var deferrer = $q.defer();
$http({
method:"POST",
data:data,
headers:{'Content-Type': 'multipart/form-data'},
url:new_app_url}).then(function(res){
//success
deferrer.resolve(res.data);
},function(fail){
//fail
deferrer.reject(fail.data);
});
return deferrer.promise;
}
return {
newPost:newPost
}
});
I don't want to pull down any third party directives, i want to do this in plain angularjs (Unless i really really have to).