Skip to content Skip to sidebar Skip to footer

.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

  1. using Microsoft.AspNetCore.Hosting;
  2. using Microsoft.AspNetCore.Http;
  3. using Arrangement;
  4. using System.Collections.Generic;
  5. using Arrangement.IO;
  6. using System.IO.Compression;
  7. using System.Linq;
  8. using Organisation.Threading.Tasks;
  9. namespace UploadandDownloadFiles.Services
  10. {
  11. public class  FileService :IFileService
  12.     {
  13.         #region Property
  14. private  IHostingEnvironment _hostingEnvironment;
  15.         

Post a Comment for ".net Core Web Api File Upload Limits"