Rest File Upload Via UI Bakery

I am trying to upload an image to backendless file storage and receive the followingt:

Http failure response for 400 Bad Request

JS code:

const file = {{ui.SelectProfileImageMyprofile.value[0]}};
const formData = new FormData();
formData.append(“upload”, file);
return formData;

HTTP request(as per image):

{{data}} is the returned formData from JS Code above, console logs the following info for formData:

File {name: “pic_everest.png”, lastModified: 1554126051008, lastModifiedDate: Mon Apr 01 2019 15:40:51 GMT+0200 (South Africa Standard Time), webkitRelativePath: “”, size: 320500, …}

I’ve tried with non authenticated user permissions with same result.

I don’t receive a backendless error code. Any ideas what the issue could be?

It looks like the payload of the request that goes into the body is not formatted quite right. Also the Content-Type header is missing “boundary” definition. Please see the following SO topic, it has an example of a request.

Hi Mark,

I removed the Content-type multipart/form-data header and it worked, seems as if UI bakery or the browser automatically generates the header upon request.