2024-06-05 12:19:46 +02:00
|
|
|
---
|
|
|
|
sidebar_position: 10
|
|
|
|
---
|
|
|
|
|
|
|
|
# Upload file
|
|
|
|
Uploads a file to disk at the specified path
|
|
|
|
|
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
`Function UploadFile(Val Token, Val Path, Val File, Val Overwrite = False) Export`
|
2024-06-05 12:19:46 +02:00
|
|
|
|
2024-08-13 14:52:26 +02:00
|
|
|
| Parameter | CLI option | Type | 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-06-05 12:19:46 +02:00
|
|
|
|
2024-08-13 14:52:26 +02:00
|
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Yandex
|
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-08-13 14:52:26 +02:00
|
|
|
|
|
|
|
Token = "y0_AgAAAABdylaOAA...";
|
|
|
|
Path = "/AlpacaInFile.png";
|
|
|
|
File = "C:\logo.png";
|
|
|
|
|
|
|
|
Response = OPI_YandexDisk.UploadFile(Token, Path, File); //Map
|
|
|
|
Response = OPI_Tools.JSONString(Response); //String
|
2024-06-05 12:19:46 +02:00
|
|
|
```
|
2024-08-13 14:52:26 +02:00
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
```sh title="CLI command example"
|
2024-08-13 14:52:26 +02:00
|
|
|
|
|
|
|
oint yadisk UploadFile --token "y0_AgAAAABdylaOAA..." --path "/AlpacaInFile.png" --file "C:\logo.png" --rewrite %rewrite%
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-08-14 08:06:31 +02:00
|
|
|
<empty string>
|
2024-06-05 12:19:46 +02:00
|
|
|
```
|