I've been working on setting up an upload of images taken using the Image Input component.
My content API is a REST API that expects a FormData file. I've managed to get it working in the editor using this code:
var b64Image = await utils.getDataByObjectURL(productPhotoInput.value[index]);
var file = {
name: "app_upload_" + Date.now() + "." + productPhotoInput.files[index].type.split("/")[1],
size: productPhotoInput.files[index].size,
type: productPhotoInput.files[index].type,
lastModified: Date.now(),
data: b64Image.replaceAll("data:image/png;base64,", "") //This needs to be removed to match the formdata format
};
... but when uploading from my actual Phone, running the app in the Retool App, the image file is corrupt.
Could the getDataByObjectURL function return different results when the app is running as a PWA inside the Retool app?? I find this hard to debug with the tools I have.