1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-12-24 00:01:24 +02:00
Files
OpenIntegrations/docs/en/md/Yandex_Disk/File-and-folder-management/Upload-file.mdx
Vitaly the Alpaca (bot) 6196c8661a Main build (Jenkins)
2025-07-15 23:11:07 +03:00

79 lines
2.2 KiB
Plaintext
Vendored

---
sidebar_position: 10
description: Upload file and other functions to work with Yandex Disk in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Yandex Disk]
---
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://hut.openintegrations.dev/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 "/67870eca-aa2d-403f-8093-6bf7b85f8872.png" \
--file "/tmp/ut5qpp31.epv.png" \
--rewrite true
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint yadisk UploadFile ^
--token "***" ^
--path "/67870eca-aa2d-403f-8093-6bf7b85f8872.png" ^
--file "/tmp/ut5qpp31.epv.png" ^
--rewrite true
```
</TabItem>
</Tabs>
```json title="Result"
{}
```