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
tip
Parameters with Binary data type can also accept file paths on disk and URLs
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);
- Bash
- CMD/Bat
oint yadisk UploadFile \
--token "***" \
--path "/8ed47363-93c2-4a70-8bfe-45976d3391c5.png" \
--file "C:\Users\Administrator\AppData\Local\Temp\nihbtitcw1k.png" \
--rewrite true
oint yadisk UploadFile ^
--token "***" ^
--path "/8ed47363-93c2-4a70-8bfe-45976d3391c5.png" ^
--file "C:\Users\Administrator\AppData\Local\Temp\nihbtitcw1k.png" ^
--rewrite true
Result
{}