I'm trying to send XMLHttpRequest() with form data appended with data and a uploaded file.
Its works fine in local enviroment. After deployment, It is working as expected only when accessed in Same domain and NOT in cross domain.
Looks like there is a issue in cross domain request to upload file.
var request = new XMLHttpRequest();
request.open("POST", url, true);
request.responseType = "text";
request.setRequestHeader("Content-Type", multipart/form-data);
request.withCredentials = true;
var file = document.getElementById("ipFile");
var formData = new formData();
formData.append("file", file.Files[0]);
formData.append("data", JSON.stringify(data));
request.send(formData);
I tried sending the formData without appending the file. It works as expected. formData appended with file is giving the cross domain request is ...
Go to the complete details ...