I tried many ways to solved my product, but it was not solved it.
where is the issues?
error code
Access to XMLHttpRequest at 'http://192.168.1.123/sms' from origin 'http://localhost:5680' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7
Access-Control-Request-Headers: access-control-allow-origin
Access-Control-Request-Method: POST
Connection: keep-alive
Host: 192.168.1.123
Origin: http://localhost:5680
Referer: http://localhost:5680/
my code
function uploadFileChunk(fileData, uploadInfo, destinationDirectory) {
axios.defaults.headers.common['Access-Control-Allow-Origin'] = '*';
let formData = new FormData();
formData.append("file", fileData);
axios
.post("http://192.168.1.123/sms", formData, {
headers: {
},
})
.then(function () {
console.log("SUCCESS!!");
})
.catch(function () {
console.log("FAILURE!!");
});
or and also what's methods can upload file?