.net Core Web Api File Upload Limits
-
- Updated date Mar 18, 2021
- 71.5k
- 16
In this article, we are going to embrace Multi-File upload and download via API
Today, we are going to encompass uploading & downloading multiple files using ASP.Internet Core 5.0 spider web API by a simple procedure.
Note
Since I accept the latest .Net v.0 installed on my machine I used this. This aforementioned technique works in .Internet Cadre 3.ane and .Internet Core ii.1 too.
Begin with creating an empty web API project in visual studio and for target framework choose .Internet 5.0.
No external packages were used in this project.
Create a Services folder and inside that create 1 FileService grade and IFileService Interface in information technology.
We have used three methods in this FileService.cs
- UploadFile
- DownloadFile
- SizeConverter
Since we need a folder to store these uploading files, here we have added one more parameter to pass the folder name as a string where information technology will store all these files.
FileService.cs
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.AspNetCore.Http;
- using Arrangement;
- using System.Collections.Generic;
- using Arrangement.IO;
- using System.IO.Compression;
- using System.Linq;
- using Organisation.Threading.Tasks;
- namespace UploadandDownloadFiles.Services
- {
- public class FileService :IFileService
- {
- #region Property
- private IHostingEnvironment _hostingEnvironment;
Post a Comment for ".net Core Web Api File Upload Limits"