I ship form-datawith image-data.
But I can not get the data on the node server when sending internally FormData.
I could see the data on the controller angularon console.log.
angular code:
$scope.saveInfo = function(){
var formData = new FormData;
console.log('Update function');
for(key in $scope.seller){
formData.append(key, $scope.seller[key]);
}
console.log(key, $scope.seller);
var file = $('#file')[0].files[0];
formData.append('image', file);
$http.put('/api/seller/businessInformation', formData, {
transformRequest: angular.Identity,
headers: {
'Content-type': undefined
}
}).then(function(res){
});
}
Node.js: I could see the image data on console.log(req.files);,
but it console.log(req.body);prints [object object].
source
share