When I use Dropzone and fetch api to upload. I always get net::ERR_ACCESS_DENIED
const handleImageChange = (files) => {
const file = files[0];
let formData = new FormData();
formData.append("file", file);
formData.append("shop_id", "1111");
let xhr = new XMLHttpRequest();
xhr.open("POST", my_API_Here, true);
xhr.onload = function () {
if (xhr.status === 200) {
console.log("Response:", xhr.responseText);
} else {
console.log("Lỗi khi upload:", xhr.status);
}
};
xhr.onerror = function () {
console.log("eror")
};
xhr.send(formData);
};
<DropZone multiple accept="image/*" onInput={handleImageChange}></DropZone>
I can make sure that file and api exist. I wonder if Web worker can upload file? Because as I know Customer Account Extension is running on Web Worker