Hi,
I have external API that expects a file as an input and provides a json response. I am trying to figure out how I can have a user upload a file to my Bubble app and then send that file from my app to this API. I know how to create the FileUploader element of course but am not able to figure out how to send the file itself.
The external API expects the file in the following format (in javascript):
const response = await fetch("<external API endpoint url>", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
data: [
{"name":"zip.zip","data":"data:@file/octet-stream;base64,UEsFBgAAAAAAAAAAAAAAAAAAAAAAAA=="},
]
})
});
Any help is highly appreciated. Thank you!