I've been attempting to retrieve the following:
fetch("https://www.filestackapi.com/api/store/S3?key=MYKEY&filename=teste", {
body: "@/C:/Users/Acer/Pictures/1 (2).jpg",
headers: {
"Content-Type": "image/png",
},
method: "POST",
});
Unfortunately, it's not working as expected.
I'm trying to upload a file from an input
in my form.
You can try this JavaScript code:
<input accept="image/*" type="file" id="imgInp" />;
var input = document.getElementById("imgInp");
var data = new FormData();
data.append("file", input.files[0]);
data.append("user", "hubot");
fetch("https://www.filestackapi.com/api/store/S3?key=MYKEY", {
method: "POST",
headers: {
"Content-Type": "image/png",
},
body: data,
});
PS.: It works in postman! Any thoughts on why it's not working elsewhere?