Skip to content

Run and test the UploadFiles Minimal API application

Mohammed Abbod edited this page Dec 9, 2022 · 1 revision

Its the time of run the application,

The application so far looks as following, and its time to run the API and the Client side in the same time:

Right click on the solution, then click on Properties

Choose the option of Multiple startup projects and choose the following:

Then run it, the 2 projects will be popup, and the upload control is now on the home page,

lets try to upload a file, click on the "Choose" then find a file from your computer, and hit the upload button:

Ops, there is an error:

Lets open the developer tool in the browser and see what is the error,

it looks something like CORS issue, and this because we are running a Blazor WebAssembly not a server project.

So the simple solution to solve this issue is by adding the CORS feature to project as follow:

Then at bottom of Program.cs add the:

Lets run it again, to upload the file:

and here is the uploaded file:

In a very simple words .NET 7 is a powerful tool that make this work easy.