Upload File Asp.net Core Web API



Upload File Asp.net Core Web API

Upload File Asp.net Core Web API

How to Upload File Asp.net Core Web API?
File/Image Upload in asp.net core –
Uploading files with asp.net 5 Web API. It is super easy to implement file upload functionality in Asp.net 5 Web API. We can use IFormFile interface to upload files in Asp.net Core Web API. This video has uploading multiple files using Swagger and Post man in Asp.net Core Web API.
————————————————————–
Upload File using Swagger
If you are using .Net 5 Web API, you need not do any configuration to add swagger to .Net 5 Web API application as Swagger is added to .Net 5 Web API application by default. If you use .Net Core 3 then you have to explicetly add SwashBuckle package and modify startup.cs class to configure the swagger in asp.net core. Once the asp.net core applicaiton runs, it opens Swagger UI. You have to choose the appropriate action and click on try it out. It will show you Add Item button. you can click on it then, it will show choose file button. you can use it to choose the file and click on Execute button to upload the files.
————————————————————
Upload Files with Postman
It is a bit tricky and not straight forward like Swagger. once you open a new tab, you have to go to request body and choose form data. you have to give parameter name which is the same as the parameter that you are accepting on the web api action. if you hover your mouse on the Key field in postman, it will show Text with down arrow. If you click on that it will File. If you chose file option it will show a button to select Files. You can click on that button to upload the files to asp.net core web api.

Chapters
00:00 Introduction
00:20 writing code for Upload File Asp.net Core Web API
05:18 Upload Files using Swagger
05:59 Upload Files using Postman

#AspNetCoreWebAPI#
#UploadFile#
#WebAPITutorial#

Comments are closed.