1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-06-06 23:46:28 +02:00

77 lines
2.0 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 10
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Upload file
Uploads a file to disk at the specified path
`Function UploadFile(Val Token, Val Path, Val File, Val Overwrite = False) Export`
2024-10-15 15:15:47 +03:00
| 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 |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Yandex
<br/>
2024-10-15 13:51:58 +03:00
:::tip
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>
2024-10-15 10:16:04 +03:00
2024-12-16 19:38:57 +03:00
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2024-10-15 10:16:04 +03:00
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);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint yadisk UploadFile \
2024-10-22 08:59:24 +03:00
--token "***" \
2024-12-25 11:43:34 +03:00
--path "/de35e5c3-fa54-4763-a81e-04eee138fd7d.png" \
--file "C:\Users\Administrator\AppData\Local\Temp\di2uiantmql.png" \
2024-10-22 08:59:24 +03:00
--rewrite true
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint yadisk UploadFile ^
2024-10-22 08:59:24 +03:00
--token "***" ^
2024-12-25 11:43:34 +03:00
--path "/de35e5c3-fa54-4763-a81e-04eee138fd7d.png" ^
--file "C:\Users\Administrator\AppData\Local\Temp\di2uiantmql.png" ^
2024-10-22 08:59:24 +03:00
--rewrite true
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{}
```