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 "/a38ebad2-e153-4378-bb47-fcec97b5f183.png" \
--file "C:\Users\Administrator\AppData\Local\Temp\tfof0t253ym.png" \
--rewrite true
oint yadisk UploadFile ^
--token "***" ^
--path "/a38ebad2-e153-4378-bb47-fcec97b5f183.png" ^
--file "C:\Users\Administrator\AppData\Local\Temp\tfof0t253ym.png" ^
--rewrite true
Result
{}