Files Upload to google drive stops working

Greetings Everybody,

Trust you are doing well.

I work on an app that upload image to the google drive using KIO4 base 64 extension.

I have to upload 2 pictures.

The app is based on a previous question helped by the community.

link: Upload files to GDrive followed by a link of the uploaded file in Google sheet - #5 by TIMAI2

All of a sudden it stops working. :confused:

I reviewed my blocks and do not understand whats wrong.

Tried the new metricat & Juan version it works but applying theit to my context, I got errors : METRIC RAT AI2 - UpLOAD Any File To Google Drive with AI2

You can wee by blocks below.

You can find my code below :

function doPost(e) {
  var data = Utilities.base64Decode(;

  var blob = Utilities.newBlob(data, e.parameters.mimetype,;


  return ContentService.createTextOutput("Picture of " + name +" uploaded");


You may find this of interest


but it may not be a solution for you...

I will see if I can work up a different working solution for you

I can't see anything obvious in your blocks, but you do have an error in your script....

return ContentService.createTextOutput("Picture of " + name +" uploaded");

should be this:
return ContentService.createTextOutput("Picture of " + +" uploaded");

Anyway, try this rework, which I have tested on companion app with Android 13

upload2PicsGDrev1.aia (26.8 KB)

and here another that takes "thumbnail" images

upload2PicsGDThumbs.aia (26.2 KB)

@TIMAI2, one thing, is the method provided from your app applicable to image component?

Like setting image component from a selected image rom an imagepicker.

The camera component have the image variable in it but not the list picker.

As you can see, the first example uses the camera component to return the when PictureTaken event. The second example (thumbnails) does not create a file, it returns the base64 directly.

If you want to use the image picker (using the first example as a base), you could probably replace the camera blocks with the imagepicker blocks. On Android 13, camera images are saved to the ASD, therefore not available to the image picker, unless you copy them to shared storage.

As the camera have an image variable that the image picker do not have.

The image variable is used by the KIO4 extension.

[Still using the first example]

If DefaultFileScope is set to "App", camera images are saved to the ASD on all Android version. If DefaultFileScope is set to "Legacy" images are saved in /My Documents/Pictues/ but only up to Android 10. On Android 11+ it is of course no longer possible to write / save in an arbitrary folder of the external storage.

Note: Unfortunately, the Camera component does not provide for saving to one of the shared folders if DefaultFileScope = Shared or Legacy is set.

Not so:


MIT did not put it in the afterPicking event....

1 Like

Hello @TIMAI2 its work fine, thank you.

One last thing before closing this matter.

To send the data we use the POST method.

I tried to do it with DoGet, based on one of my precious question Secure connection to google sheet and app script - #8 by TIMAI2
where I used a key as parameter to append the data.

Is it possible to do it with pictures too?

I tried but I got errors.

Why do you "need" to use doGet(e) ? doPost(e) works just fine, and can probably more easily cope with large base64Strings

1 Like

Ok acknoledge thanks

Image Upload discrepancies

Hello all, trust you are doing well.

I'm current working on project to upload picture to google drive.

I was helped by @TIMAI2 who helped me in uploading the picture to the drive.

The app take 2 pictures from the image picker and set the Image component with the selected images.

Now I am facing an issue where I can upload the picture but is wrongly uploaded.[Not the image].

Here is my blocks :



The code use:

function doPost(e) {
  var data = Utilities.base64Decode(;
  var name = ;

  var filename =  name + ", Orders of the " + Utilities.formatDate(new Date(), "GMT+8", "EE dd-MM-yyyy HH:mm:ss");

  var blob = Utilities.newBlob(data, e.parameters.mimetype, filename);


  return ContentService.createTextOutput("Picture of " + name + " uploaded");


The error i got from the response :

The uploaded images :

1 out of 2

2 out of 2

To begin with, remove the comma where you make the filename, replace with hyphen or underscore. It would be better to have no spaces in your filename, at all, so use underscores if you need separation.

Hello @TIMAI2 issue perist.

When I modified your aia, I got and issue reponse but it worked, the picture was uploaded with the filename.

In my app I replicated the same blocks but got the issue mentionned.

I have provided two working solutions, you need to follow these correctly and apply to your particular requirements.

That what I did. :confused:

I followed the blocks and did not miss the important block.

But you have indicated that you modified it!

Yes I modified it only in term of image capture.
I change only the camera block and replace the variable image fom the camera block to the image picker.

The other block are only interm of layout.

Provide an aia project, you can replace any specific values with identifiable variables. Also provide your script. I will see what I can do with it.

Hello my apologies I was sick, I will upload the aia asap.