Whenever I attempt to upload an image from my existing files, everything goes smoothly. However, if I try to select a file by directly clicking on the camera icon on my mobile device, it fails with a "CORS Error" message. I have tried adding and removing the "Access-Control-Allow-Origin" attribute, but neither solution has resolved the issue.
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);
});
}
I am seeking assistance in finding a resolution to this problem.