FileTransferUsingHttpClient
FileTransferUsingHttpClient copied to clipboard
Upload/Download Files Using HttpClient in C#
HttpClient sending Multipart form-data
Medium Article: Upload/Download Files Using HttpClient in C#
This solution includes two projects, ClientSideApp and ServerSideApp.
-
The
ServerSideAppproject contains an API controllerFilesController, which includes two actions for (1) uploading a file with Multipart form-data, and (2) downloading a file. TheServerSideAppproject also contains a web page for uploading a file. -
The
ClientSideAppproject is a Console application that uploads a*.txtfile to the API endpoint in theServerSideApp, then download the file from theServerSideApp. TheClientSideAppproject demonstrates an example of sending multipart form-data using HttpClient.
The following gif image shows the screen recording of the working demo.

License
Feel free to use the code in this repository as it is under MIT license.