Tell me, is it possible to do without asynchronous await/async operations in the code to load the file?
Resource is used to download the file: https://anonfile.com/docs/api
To work with the API resource provides the code:
curl -F "file=@test.txt" https://anonfile.com/?token=s245v7ebt3sn7kf5 The curl code converted to C# on the service: https://curl.olsh.me/
Got result:
using (var httpClient = new HttpClient()) { using (var request = new HttpRequestMessage(new HttpMethod("POST"), "https://anonfile.com/?token=s245v7ebt3sn7kf5")) { var multipartContent = new MultipartFormDataContent(); multipartContent.Add(new ByteArrayContent(File.ReadAllBytes("test.txt")), "file", Path.GetFileName("test.txt")); request.Content = multipartContent; var response = await httpClient.SendAsync(request); } } The problem in the code is the last line:
var response = await httpClient.SendAsync(request); When I insert this code into the button, I have to add async and use version NetFramework 4.5+
private async void button1_Click(object sender, EventArgs e) Is it possible to get rid of await/async so that the file is loaded in another way?

using (var wc = new WebClient()) wc.DownloadFile("url", "file_path");- tym32167var response = httpClient.SendAsync(request).GetAwaiter().GetResult();- Bulson