async function uploadBase64Image(base64String, fileName) {
console.log("File Name:", fileName);
console.log("Base64 Length:", base64String.length);
// Extract base64 data
const base64Data = base64String.split(",")[1]?.trim();
if (!base64Data) {
console.error("Invalid base64 string!");
return;
}
// Convert Base64 to binary
const byteCharacters = atob(base64Data);
const byteNumbers = new Array(byteCharacters.length);
for (let i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
const blob = new Blob([byteArray], { type: "image/jpeg" });
const fileObject = new File([blob], fileName, { type: "image/jpeg" });
console.log("file:",fileObject)
console.log("Blob Size:", blob.size); // Check if it's still 15B or larger
// Upload to S3
const response = await uploadtos3.trigger({
additionalScope: {
key: fileName,
value: blob
}
});
console.log("Upload Response:", JSON.stringify(response));
}
var base64,file;
uploadBase64Image(base64,file)
in s3 upload query, im using either 'image/jpeg' or binary
and image is uploaded fine when im testing with retool mobile via webiste/editor.
But when i try this exactly with Retool Mobile App. the data uploaded into s3 is always 15.0B no matter what.
I mean everything works fine in web app but not in mobile app. SO something might be wrong in mobile app or help me with this,