I am trying to upload a file through the external API. I can retrieve the upload server URL with an API call. Now I need to send the file to it. API docs says I must send a POST request with the file. But my request is being blocked by CORS. I am sending it like this:
var request = new XMLHttpRequest();
request.open('POST', data["response"]["upload_url"], true);
request.overrideMimeType("multipart/form-data")
request.onload = function () {
// ...
};
request.send({"file": f});
How do I properly send the request?