Skip to main content

Upload file

Uploads a file to disk at the specified path

Function UploadFile(Val Token, Val Path, Val File, Val Overwrite = False) Export

ParameterCLI optionTypeDescription
Token--tokenStringToken
Path--pathStringPath for saving the file to disk
File--fileString, BinaryDataFile for upload
Overwrite--rewriteBooleanOverwrite if a file with the same name already exists

Returns: Map Of KeyAndValue - serialized JSON response from Yandex


Code example
    Path1 = "/" + String(New UUID) + ".png";
Path2 = "/" + String(New UUID) + ".png";

Token = "y0_AgAAAABdylaOAAs0QgAAAAD5i-a...";
Image = "https://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);
CLI command example
    
oint yadisk UploadFile --token "y0_AgAAAABdylaOAA..." --path "/AlpacaInFile.png" --file "C:\logo.png" --rewrite %rewrite%

Result
<empty string>