Upload/Download Files Using HttpClient in C#
In this new post, I show you how to upload/download files using HttpClient in C# and .NET Core. Creating a new version of the Markdown Editor component for Blazor, I face some issues with the file upload. So, I was working to find a solution and now I can tell you how to do it.
First, I will take a look at how to send multipart MIME data to a Web API using HttpClient. We will create two applications to demonstrate the data transfer between the client side and the server side. The server-side app is an ASP.NET Core web project, which includes a Web API controller
for uploading and downloading files. The client-side app is a Console project
, which contains a Typed HttpClient to send HTTP requests for file uploading and/or downloading.
The full explanetion of the code is in this post on PureSourceCode.