Upload file
Uploads a file to the drive
Function UploadFile(Val Token, Val File, Val Description) Export
Parameter | CLI option | Type | Required | Description |
---|---|---|---|---|
Token | --token | String | ✔ | Token |
File | --file | BinaryData,String | ✔ | File to be uploaded |
Description | --props | Map Of KeyAndValue | ✔ | JSON description or path to .json |
Returns: Map Of KeyAndValue - serialized JSON response from Google
tip
Parameters with Binary data type can also accept file paths on disk and URLs
1C:Enterprise/OneScript code example
Token = "ya29.a0AcM612wmWdggP-K6tOc3UqW0KxYMjUi60_Uhu-ERltTaavHGbML0nRBXqkuiBcr0GNmR_1gHKowaF1Rd_4Q5Amc9O23DEBZ95sNEGnpR5...";
Image = "https://api.athenaeum.digital/test_data/picture.jpg";
Directory = "191iyaa6-2BCNRPOF0F8mQ0TuNWPNesdM";
Description = OPI_GoogleDrive.GetFileDescription();
Description.Insert("Parent", Directory);
Result = OPI_GoogleDrive.UploadFile(Token, Image, Description);
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint gdrive UploadFile \
--token "***" \
--file "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg" \
--props "{'MIME':'image/jpeg','Name':'New file.jpg','Description':'This is a new file','Parent':'1Q3vl7hcmdeJvd86jC84pdGKW5772apUy'}"
:: JSON data can also be passed as a path to a .json file
oint gdrive UploadFile ^
--token "***" ^
--file "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg" ^
--props "{'MIME':'image/jpeg','Name':'New file.jpg','Description':'This is a new file','Parent':'1Q3vl7hcmdeJvd86jC84pdGKW5772apUy'}"
Result
{
"kind": "drive#file",
"id": "1iscrZRfSVq4khO1E3n-uSbfSFDTZfYdE",
"name": "New file.jpg",
"mimeType": "image/jpeg"
}