I want select a photo and send to google drive.why the companion send photo but phone dont send?

Hi i want select a photo and send to google drive.why the companion send photo but phone dont send and application be closed?


2

i searched in community and find very related subjects but my mistake remain.thanks for help me

Check your filepath before encoding
Save base64 to variable, not label
Remove folder id from postext if hard coded in script

also see here

There may be file permissions issues once this is compiled, depending on where the image is stored and who created it.

1 Like

Hi thanks.
i save base64 to variable instead of labels.

If i remove folder id from post text app script,then companion too dont send image to googledrive.
do i checki which file path?
Thanks .i have too mistakes!
I read in internet that kio4_base 64 extension convert image path to large data and i see this large data in lables.can this subject is cause of my mistake?

You need to decide:

Set folderId in your blocks and send it as a parameter (e.parameter.folderId)
or set folderId in the script

Is your image being correctly converted to base64 now ?

function doPost(e){
var data = Utilities. base64Decode(e.parameters.data);
var blob = Utilities. newBlob(data, e.parameters.mimetype, e.parameters.filename);
DriveApp.getFolderById('1cN6hP-JCa7UGeCj9tqqwIhUB13kZ67eA').createFile(blob);
return ContentService.createTextOutput("your File Successfully Uploaded");
}

are above blocks correct?

image

set base64String to string (you set string to string), and set Label13 after you have encoded
image
you can also remove the line returns (\n) if you want.

Set data to base64String
image

In your script, remove the spaces that you are showing after Utilities

Utilities. base64Decode... >> Utilities.base64Decode...
Utilities. newBlob... >> Utilities.newBlob...

Hi thanks .no .dont work.

this too dont work with phone but work with ai2 companion.what is different between ai2 companion and phone?

There are some errors in your blocks, see my edited post above...

Do you mean when you have compiled the app ?

yes .when compile as ???.apk dont work.

:fu: apk adress

I have just edited you aia project, compiled and tested, works OK for me

pasokhnameh_revised.aia (49.2 KB)

above pasokhname.apk work ?

work with companion

dont work with phone

dont work for me

You apk is not putting anything in Label13, therefore the upload will not run

i change Save base64 to variable(path)instead of label 13. .AIA and APK are same.

I compiled your aia project

Blocks

and it worked and uploaded a file OK (Tested on Android 10 and Android 11 devices)

I am confused. thanks. I have to be more careful to find fault with my work. Thank you :rose:

my phone android is 8.


ai2 companion :fu:

Yes, it crashes on my 8.1 test device. OK,we are getting somewhere.....hang on


:fu: in my phone

Hi thanks. :rose: ok apk work with android 11 phone :laughing:

1 Like