Send image via API to AMAZON AWS

Asked

Viewed 26 times

1

I need to send an image via jquery or javascript to an API hosted on Amazon. I can send it through Postman, it shows me this sending code:

var form = new FormData();
form.append("file", "http://www.site.com.br/2017-09-06-11-40-43.jpg");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "url API",
  "method": "POST",
  "headers": {
    "authorization": "Basic==",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
</script>

It returns me error 400. I tried via PHP’s Curl and it won’t either.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.