Download multiple files web api






















We have gone over the details about downloading files via Web API. I hope you have learned something new. Thanks for reading.

Senior Application Developer. I write blogs about. Bursts of code to power through your day. Web Development articles, tutorials, and news. Sign in. Changhui Xu Follow. Written by Changhui Xu Follow.

More From Medium. Accessing Azure Analysis Services Models using. NET Core. Sanjay Bhagia. Vincent A. Fixed-Rate Protocol. Vivek Chanddru in Adventurous Android. Mvc; using Microsoft.

Configuration; using Microsoft. DependencyInjection; using Microsoft. Logging; using Microsoft. Models; using System; using System. Tasks; using UploadandDownloadFiles. Use this method to add services to the container. AddControllers ; services. Use this method to configure the HTTP request pipeline. UseDeveloperExceptionPage ; app. UseSwagger ; app. UseHttpsRedirection ; app.

UseRouting ; app. UseAuthorization ; app. Http; using Microsoft. Mvc; using System; using System. DataAnnotations; using System. Services; namespace UploadandDownloadFiles. SizeConverter formFiles. Here we see our two API's which we have created to upload and download, so let's test each of these individually. Pass the folder name inside the subDirectory and add files below to save inside the server and under the folder name. Seek 0, SeekOrigin.

Improve this question. Prabodh Mhalgi 5 5 silver badges 21 21 bronze badges. Md Aslam Md Aslam 4 4 gold badges 18 18 silver badges 44 44 bronze badges. I know it's going to be 2 years. Did you figure out a solution for this? I'm running into same issue. Can you please share your findings? Add a comment. Active Oldest Votes. Improve this answer. Mehdi Ibrahim Mehdi Ibrahim 1, 10 10 silver badges 10 10 bronze badges. Mehdi, I have tried the zipping option its working fine but the requirement here is separately it should download, so Is it possible?

The alternative I would suggest is the latter part of my answer - can you change your API to take in a single docId and iterate over your API from your client for each docId? I have a method to download a single document also. Anyway, Thank you so much for your explanation but If you can provide some sample code for this multi doc download No Problem even it will work in one browser only , help me with this. Not sure why you feel calling the API one at a time for each docId in a loop would produce a different end result.

This will give you the multiple document download functionality - in a cross browser compatible way. In http, one request can only have one response. Also did you try your own solution with Firefox? MdAslam Yeah I think Mehdi is right. You can just use loop in frontend to download multiple files. Can you please share your frontend code?



0コメント

  • 1000 / 1000