I am trying to send an image to an API to be processed, the problem is that I need to send the image captured by the pc webcam,
imageCapture.takePhoto().then(function (blob) {
var imagen = new File([blob], "name",{type:"image/jpeg"});
fileUpload[0] = imagen;
});
That's how I keep the image in a variable, and so I send it to the API:
var formData = new FormData();
formData.append('files', fileUpload[0]);
var obj = {};
var res = "";
var oControl = this.getView().byId("txtArea");
$.ajax("/service/models/personas/versions/2", {
type: "POST",
data: formData,
cache: false,
headers: {
"Authorization": "Bearer " + token
},
But I get the following error:
Error when uploading files:: Invalid file type
I have already used it before sending an image with the same "jpeg" format with Postman and it works, so what am I doing wrong?
Hope you can help me, thanks.