Skip to content

Instantly share code, notes, and snippets.

@csprofile
Created February 24, 2017 11:37
Show Gist options
  • Save csprofile/886fe1a27bd2f9a46802669ace457d64 to your computer and use it in GitHub Desktop.
Save csprofile/886fe1a27bd2f9a46802669ace457d64 to your computer and use it in GitHub Desktop.
$http({
method: 'POST',
url: '/upload-file',
headers: {
'Content-Type': 'multipart/form-data'
},
data: {
email: Utils.getUserInfo().email,
token: Utils.getUserInfo().token,
upload: $scope.file
},
transformRequest: function (data, headersGetter) {
var formData = new FormData();
angular.forEach(data, function (value, key) {
formData.append(key, value);
});
var headers = headersGetter();
delete headers['Content-Type'];
return formData;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment