How to upload a file from Angular 6 to ASP.NET Core 2.1 Web API Application step by step
This post talks about how to upload a file from Angular 6 to ASP.NET Core 2.1 Web API. First thing first, let’s create an Angular 6 app with Visual Studio 2017. To do that, open Visual Studio 2017 community edition , hit Ctrl+Shift+N and select the ASP.NET Core Web Application (.NET Core) project type from the templates. When you click Ok, you will get the following prompt, Make sure to select “ASP.NET Core 2.1” from the version dropdown and choose Angular. The Visual Studio will create an ASP.NET Core 2.1 based project with Angular 6 configured. This should create an Angular 6 app. You should run the app to make sure that there are no errors. Create Upload API in ASP.NET Core To support uploading on the server, add a Web API controller named UploadController in the Controller folder. This controller has the API to upload the file and store it at a location. Add the controller with the following code. using Microsoft.AspNetCore.