mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-05-29 23:17:45 +02:00
77 lines
2.0 KiB
Plaintext
Vendored
77 lines
2.0 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 10
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Upload file
|
|
Uploads a file to disk at the specified path
|
|
|
|
|
|
|
|
`Function UploadFile(Val Token, Val Path, Val File, Val Overwrite = False) Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| Token | --token | String | ✔ | Token |
|
|
| Path | --path | String | ✔ | Path for saving the file to disk |
|
|
| File | --file | String, BinaryData | ✔ | File for upload |
|
|
| Overwrite | --rewrite | Boolean | ✖ | Overwrite if a file with the same name already exists |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Yandex
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Parameters with Binary data type can also accept file paths on disk and URLs
|
|
:::
|
|
<br/>
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
Path1 = "/" + String(New UUID) + ".png";
|
|
Path2 = "/" + String(New UUID) + ".png";
|
|
|
|
Token = "y0_AgAAAABdylaOAAs0QgAAAAD5i-a...";
|
|
Image = "https://api.athenaeum.digital/test_data/picture.jpg"; // URL
|
|
|
|
TFN = GetTempFileName("png"); // Path
|
|
CopyFile(Image, TFN);
|
|
|
|
Result = OPI_YandexDisk.UploadFile(Token, Path1, Image, True);
|
|
|
|
Result = OPI_YandexDisk.UploadFile(Token, Path2, TFN, True);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
oint yadisk UploadFile \
|
|
--token "***" \
|
|
--path "/de35e5c3-fa54-4763-a81e-04eee138fd7d.png" \
|
|
--file "C:\Users\Administrator\AppData\Local\Temp\di2uiantmql.png" \
|
|
--rewrite true
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
oint yadisk UploadFile ^
|
|
--token "***" ^
|
|
--path "/de35e5c3-fa54-4763-a81e-04eee138fd7d.png" ^
|
|
--file "C:\Users\Administrator\AppData\Local\Temp\di2uiantmql.png" ^
|
|
--rewrite true
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{}
|
|
```
|