1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-04-27 12:32:33 +02:00
Vitaly the Alpaca (bot) 2f65e68ce4 Main build (Jenkins)
2024-11-11 22:11:22 +03:00

78 lines
2.3 KiB
Plaintext

---
sidebar_position: 4
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# 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
<br/>
:::tip
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Token = "ya29.a0AeDClZCVfxXCE-JAcPJed8p82WT_K0Jtttw0mCwT02IVORX3qB2e7AM-8OQCJa8ImTUNCA5F--f_CULx1mArjs-Se30Fonbdtroe7NaOe...";
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);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
# 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'}"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
:: 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'}"
```
</TabItem>
</Tabs>
```json title="Result"
{
"kind": "drive#file",
"id": "1iscrZRfSVq4khO1E3n-uSbfSFDTZfYdE",
"name": "New file.jpg",
"mimeType": "image/jpeg"
}
```