2024-06-05 12:19:46 +02:00
|
|
|
---
|
|
|
|
sidebar_position: 4
|
|
|
|
---
|
|
|
|
|
|
|
|
# Upload file
|
|
|
|
Uploads a file to the drive
|
|
|
|
|
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
`Function UploadFile(Val Token, Val File, Val Description) Export`
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
| Parameter | CLI option | Type | Destination |
|
|
|
|
|-|-|-|-|
|
|
|
|
| Token | --token | String | Token |
|
|
|
|
| File | --file | BinaryData,String | File to be uploaded |
|
2024-06-06 14:33:52 +02:00
|
|
|
| Description | --props | Map Of KeyAndValue | JSON description or path to .json |
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
|
2024-06-06 14:33:52 +02:00
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Google
|
2024-06-05 12:19:46 +02:00
|
|
|
|
2024-07-10 13:05:58 +02:00
|
|
|
<br/>
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
```bsl title="Code example"
|
2024-07-10 13:11:17 +02:00
|
|
|
Description = New Map;
|
2024-06-05 12:19:46 +02:00
|
|
|
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
|
|
|
|
```
|
2024-07-10 10:59:55 +02:00
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
```sh title="CLI command example"
|
|
|
|
|
|
|
|
oint gdrive UploadFile --token %token% --file %file% --props %props%
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-07-10 13:11:17 +02:00
|
|
|
{
|
2024-06-05 12:19:46 +02:00
|
|
|
"mimeType": "image/jpeg",
|
|
|
|
"name": "New file.jpg",
|
|
|
|
"id": "16hPGNTMmbnXhz_g0vjGbrLP19h56RwIg",
|
|
|
|
"kind": "drive#file"
|
|
|
|
}
|
|
|
|
```
|