When I am trying to upload a picture from the existing files it is working without any issues. But when I choose a file directly by clicking from the camera from mobile it fails showing "CORS Error". I added "Access-Control-Allow-Origin" and I removed it none of them helps.
userData.getRequestCallbackWithPrescription = (req, result) => {
var data = new FormData();
data.append("call_request[call_time]", req.call_time);
req.image_upload.forEach((obj, i) => {
data.append(`prescription_upload[image_upload][${i}][image]`, obj.file, obj.file.name)
})
return $http({
method: "POST",
url: globalUrl + '/api/' + apiVersion + '/customer/web/call_requests',
headers: {
"Access-Control-Allow-Origin": "*",
'Content-Type': undefined,
"X-Auth-Token": $rootScope.UserDetails.Auth,
},
data
})
.then(function (response) {
return result(response.data);
}, function (response) {
return result(response);
});
}
Please help me with finding the solution.