Uploading image taken by camera directly to google drive

Hello developers,
I want to upload image taken by camera to the google drive using UpLOAD Any File To Google Drive with AI2 method. when I use this, it uploads with my given name and has google id but it is an empty file with 0kb size and no preview. when I upload image by image picker manually it is ok. Here these are my blocks:
component_method
blocks (3)


How can I fix this to upload an image after taken by camera correctly?

You make no mention of your google apps script web app.

Is this setup correctly as per my guide ?

What do you see in your responseContent ?

All that said, it appears to be working...

You may/will need to remove the file:// prefix from the image file path before converting to base64. You did not "copy" that from my blocks...

I presume this is using Google Drive (signed in to a Google Account) directly ?

Thank you @TIMAI2

This is my web App and yes it is according your guide and deployed correctly:

function doPost(e) {
   var contents = JSON.parse(e.postData.contents.replace(/\n/g, ""));
   var fileName = contents.filename;
   var data = Utilities.base64Decode(contents.file);
   var blob = Utilities.newBlob(data, e.postData.type, fileName);
   var folderId = "1VLaDQmo59T9pwQtNBT-XXXXXXXXX"; // Ensure the folder ID is a string
   var fileId = DriveApp.getFolderById(folderId).createFile(blob).getId();
   return ContentService.createTextOutput('{"fileName": "'+ fileName + '", "fileId": "' + fileId + '"}');
}

when I upload from image picker or camera I will see the google ID include file name.

No, I am able to upload to destination folder in google drive from both image picker and camera without signing in to the google drive, uploading from image picker manually is ok, but when upload from camera it has name and google ID, but is 0kb and I can not use it anywhere.
Please check the below .AIA,
PhotoUploadCheck.aia (9.4 KB)

Did you add the blocks to remove the file:// prefix ?

Tested your aia (after adding blocks to handle the file:// prefix)

Works fine for me in companion for both image picker (orangeSquare) and camera (purpleRectangle)

(you should see these two files in your google drive)

PhotoUploadCheck (2).aia (9.5 KB)

it is ok now, I could upload image from camera when remove the file:// prefix.
Thanks for your help