Skip to main content

Upload file

Uploads a file to the drive

Function UploadFile(Val Token, Val File, Val Description) Export

ParameterCLI optionTypeDescription
Token--tokenStringToken
File--fileBinaryData,StringFile to be uploaded
Description--propsMap Of KeyAndValueJSON description or path to .json

Returns: Map Of KeyAndValue - serialized JSON response from Google


Code example
  
Description = New Map;
Description.Insert("MIME", "image/jpeg");
Description.Insert("Name", "New file.jpg");
Description.Insert("Description", "This is a new file");
Description.Insert("Parent", "root");

Image = "C:\OPI\image.jpg";

Response = OPI_GoogleDrive.UploadFile(Token, Image, Description); //Map
Response = OPI_Tools.JSONString(Response); //String
CLI command example
    
oint gdrive UploadFile --token %token% --file %file% --props %props%

Result
{
"mimeType": "image/jpeg",
"name": "New file.jpg",
"id": "16hPGNTMmbnXhz_g0vjGbrLP19h56RwIg",
"kind": "drive#file"
}