I am working on a project where I have to upload a small bit of JSON with a file, working in AngularJS.
I've written code using Danial Farid's angular-file-upload, and it is working, except, it always sends "multipart/form-data, boundary=<whatever>"
However, I MUST use multipart/mixed.
This is my call:
$scope.upload = $upload.upload({
url: <my url>,
method: 'POST',
data: $scope.data,
file: file,
}).progress(function(evt) {
console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total));
}).success(function(data, status, headers, config) {
// file is uploaded successfully
console.log(data);
});
Is there a way to modify the headers just before it gets sent?
If not using his angular-file-upload, then by another method, hopefully without having to 'roll my own' function?
Edit 1:
I just cannot understand how it can be so difficult to make this change. Of course you can add
headers: {'Content-Type': 'multipart/mixed'}
But this does absolutely NOTHING because there is no boundary. Why can't there be a way to pull the boundary out? Something like
headers: {'Content-Type': 'multipart/mixed, boundary=%b'}
I need to get this working ASAP.