React.js + .NET is an amazing stack to create scaleable and high performance full stack applications. A common scenario is when we need to send files to a server in order to save them in a cloud service like Amazon S3 or Azure blob storage.
In this article, you will learn how to send files to .NET API from a React.js application.
First, In .NET we will create and endpoint with this
If you want to try this endpoint you can use Postman with the following settings:
![]()
With this endpoint, we can read the file, all its properties and do something else like save it in Amazon S3.
Now, let's implement the client code.
FormData helps us to send information with Content-Type:multipart/form-data and send files in HtmlForm format.
Also, you can add a format filter in the input file if you need it.
With this approach, you can upload files to the server in a simple and save way.