Connect with camera and google drive

Hello, I want to take a phone and send to google drive. Normaly work to send .png file (it must save in programming) but I want to send new camera photo and I want to give manuel name. I tried to take photo and it is success but not connect with "send code"

Thanks.

Does it work if you send the star or plus image ?

The camera only takes .jpg images.

yes you are correct. I can change .png and .jpg. But how to can connect camera and this transfer codes? Because now menu ls selection and system use internal storage but I will take photo with camera.

My idea I can save camera image in device. But I can not file way.
Thanks

It seems you are possibly using the wrong guide, your script and blocks are for updating an existing file, not simply to upload a camera image?

My goal here is to send the photo taken to Google Drive. Normally we can transmit registered .png files. I also wanted to transfer the data I received from the camera. It also gives the script ID code in the codes, and in that respect it does two things at the same time. In this way, I will be able to save the image I added to my database and restore it.

it is my referance website.

Try this:

BLOCKS

SCRIPT

function doPost(e) {

    var data = Utilities.base64Decode(e.parameters.data);
    var blob = Utilities.newBlob(data, e.parameters.mimetype, e.parameters.filename);
    var fileID = DriveApp.getFolderById(e.parameters.folderId).createFile(blob).getId();
    return ContentService.createTextOutput(fileID);

    }
1 Like

:frowning: not work. Can you send to sample file?
Thanks

Works OK here. Check that the script has been correctly authorised (Run it in the script editor)

1 Like

yes it is work. thank you very much.

For reference:

1 Like

Is there a chance to see the transfer status of the data? For example, data transfer bar or data transfer message or waiting symbol? Can it give us a warning in case it cannot be sent?

You can use the notifier progress dialog.

You could test for a network connection before sending the file...

1 Like

hi, i got error TypeError: Cannot read properties of undefined (reading 'parameters')
what should must do


..

ss after i get response

Have you authorized the scripts file? scriptURL must correct and
it has this sentence: https://script.google.com/macros/

Google Drive folder ID very important: https://drive.google.com/drive/u/0/folders/......

thanks for help...i try buddy

1 Like

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