Uploading photo without image picker

Hi

i have not yet chosen where I was going to download my photos but I would like to know if it is possible to download a photo without using image picker send the photo we have just taken directly to the cloud

regards

Yes.

You will probably need to use a file extension to find the file, unless you gather the file location information in some other method (e.g. if you take photo with camera)

Yes it's what i want to do :
take a picture with camera and send it
I have to know how camera manage files ....

See this guide by @Anke

Then we need to know where you want to send the image to provide the correct instructions.....

hi

thanks for your answer as a developer apprentice there are things that speak to me and others not as is the case here
I can see the extensions but then it's foggy
I will choose google drive to save my photos
i saw in the Anke post she decided to use numbers but i think i can name the photos differently i suppose

regards

Upload Any File To Google Drive with AI2

1 Like

hi

I found an accessible tutorial for me even if I do not understand everything
but to implement it I don't know which script to go with it ....

regards

so all is fine r do u need anything

Hi

:upside_down_face:

no everything is not going well i did not find the script that is going well
the block "set web1.url" is empty

cordially

hi

I think I found the right script I copied it by modifying the Id folder

I take the photo and invariably after a few seconds it marks me upload successful but there are no photos in the destination folder
apparently the application comes into contact with the script but after that nothing works ...

regards

What was wrong with the link I provided in post 6 above? You are using an older version (from the blocks I can see)

Hi

I found several solutions of which you are at the origin for some
and I have the impression that they all use an image picker or tiny db
while I want to send the image captured by the camera in stride to google drive

Use that guide as a base, then modify using this one:

https://groups.google.com/d/msg/mitappinventortest/Q2hbpYz8m3I/9KJIJYRZCgAJ

I thought this is i was doing

Why having trouble with script then ?

hi

i use this script

function doGet(e) {
 return message("Error: Please Try Again");
    
}

function doPost(e) {
  if (!e.parameters.filename || !e.parameters.file || !e.parameters.imageformat) {
    return message("Error: Please Try Again");
  } else {
    var imgf = e.parameters.imageformat[0].toUpperCase();
    var mime =
        (imgf == 'BMP')  ? MimeType.BMP
      : (imgf == 'GIF')  ? MimeType.GIF
      : (imgf == 'JPEG') ? MimeType.JPEG
      : (imgf == 'JPG')  ? MimeType.JPEG
      : (imgf == 'PNG')  ? MimeType.PNG
      : (imgf == 'SVG')  ? MimeType.SVG
      : false;
    if (mime) {
      var data = Utilities.base64Decode(e.parameters.file, Utilities.Charset.UTF_8);
      var blob = Utilities.newBlob(data, mime, e.parameters.filename);
      
      
      var imageID = DriveApp.getFolderById('17rDnVVLt2Wb19gq8CWKbfRB8WGscbfkF').createFile(blob).getId();
     
     
      return message("Success: Image Uploaded");
    } else {
      return message("Error: Please Try Again");
    }
  }
}

function message(msg) {
  return ContentService.createTextOutput(msg);
}

Utilities.base64Decode is an internal function of appscript ?

Try with this:

function doPost(e) {

    var data = Utilities.base64Decode(e.parameters.data);

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

    DriveApp.getFolderById('<YOUR FOLDER ID HERE>').createFile(blob);

    return ContentService.createTextOutput("Your File Successfully Uploaded");

    }

mais dans les blocs je n'ai pas de parametre data

In the last part of the join, change

&file=

to

&data=

hi

I started again from zero and qd I understood that image was the name of the file and that it was necessary to verify the writing of the parameters sent in the request and well it worked

Thanks Tim