I am still confused in different ways of downloading files. The backend server is not under my control, but I can upload the file using the Swagger or Postman page. This means that the server is operating normally. But when I use AngularJS to load, this will not work.
Here's what works using Postman for testing. I just use form-data :

Note that request headers have Content-Type as multipart / form-data. But the request payload has filename and Content-Type as image / png.
Here is my code:
$http({ method: 'POST', url: ApiUrlFull + 'Job/Item?smartTermId=0&name=aaa1&quantity=1&ApiKey=ABC', headers: { 'Content-Type': undefined }, transformRequest: function(data) { var fd = new FormData(); fd.append('file', params.imageData); return fd; } })
params is just an object with the file imageData in imageData .
My code also sends similar URL parameters (so we can ignore the causing problems). But the request payload is base64, and it looks different since the filename field is missing.

I have zero control backend and it is written in .NET.
So, I think, my question is: using Angular (either $ http or $ resource), how do I change the request so that I send the correct Request Payload the way Postman does it? I canβt figure out how to do this.
I tried this https://github.com/danialfarid/ng-file-upload , and actually this is an OPTIONS request first before POST (assuming there is a CORS problem). But the server provided 405 errors for OPTIONS.
source share