KIO4_BASE64 : Renaming 2 groups of images to drive

Greetings everybody!

Another day another another bug :smiley:

I have to sets of picture to be uploaded to google drive with the use of app script.
Group 1 group 2

The app script :

  1. Rename the image
  2. Add a timestamp
  3. Add a text.

I use a key as to secure the connection.

To send the picture I use the KIO4_BASE64.

I need to add a text "Before" to the group 1 and "After" to group 2.

It is defined in the app script but can not define the latter in app inventor as the block .GotString can be used once only.

You can see my blocks here:

and here is my code :

function doGet(e) {
  var name = e.parameter.name;
  var mimetype = e.parameter.mimetype;
  var data = e.parameter.data;
  var Aname = "After_" + name + ", status " + Utilities.formatDate(new Date(), "GMT+4", " "HH:mm:ss");
  var Bname = "Before_" +name + ", status" + Utilities.formatDate(new Date(), "GMT+4", "HH:mm:ss");

  if(Hkey == "12345"){

  var data = Utilities.base64Decode(data);
  var blob = Utilities.newBlob(data, mimetype, Bname);
  DriveApp.getFolderById('xxxxxxxxxxxxxxxxxxxxxxx').createFile(blob);

  }
  
if(Hkey=="67890"){
    
  var data = Utilities.base64Decode(data);
  var blob = Utilities.newBlob(data, mimetype, Aname);
  DriveApp.getFolderById('xxxxxxxxxxxxxxxxxxxxxxx').createFile(blob);

  }

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

Where do you set the variable "Hkey" ?

In the web block.

I was thinking of using another web component for the after pictures but the KIO4 got string block can be use only once.

Yes, but you do not set it in your script....

Can you also show a screenshot of your app before you start sending images

This may be of some help:

Hello, I find a solution where I use 2 KIO4_BASE64 to send the 2 groups of data.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.