Web Api Download Multiple Files

  Рет қаралды 3,765

AzureTeach•Net

AzureTeach•Net

Күн бұрын

Пікірлер: 10
@saidheerajd6199
@saidheerajd6199 Жыл бұрын
Which file method are you using In the last line return File(outstretched.ToArray(),...)
@azureteachnet
@azureteachnet Жыл бұрын
That is default Web API File method which returns FileResult. Please subscribe to the channel if you have not subscribed yet. Thanks.
@gideonzweijtzer5157
@gideonzweijtzer5157 2 жыл бұрын
You're still downloading just one file, the ZIP... I am looking for the solution that returns multiple files in one request. Wouldn't it be possible to use a multipart mime for this? I know a website that returns multiple files, but I can't try it out right now. Would love to see the capture of these transfers to see what http headers are used and what is the transfer encoding, content disposition etc.
@azureteachnet
@azureteachnet 2 жыл бұрын
All those headers are set by the method File which is being returned from the action. Though the file being downloaded is one file which is zip, however it in turns contains multiple files rite? If you want to download multiple individual files in one request cant we create zip out of those files and return zip file? If you still want to download multiple individual files but not zip files, one option is make your front end to send requests multiple times with some parameters, may be like File1.txt in the first request and File2.txt in next request .. so on. All these requests should be sent in a loop after clicking on download button on the UI.
@vishal815
@vishal815 2 жыл бұрын
But u r giving path into it how we can set because it is going to download in client machine, thanks
@azureteachnet
@azureteachnet 2 жыл бұрын
Thanks for your question. We are reading the files from the local machine.. and returning it as a fzip file through api. As I have tested it locally, you are seeing the local drive.. however in server, we may read it from a shared drive or ftp location. you are RETURNING those files as zip. You are not returning the access to the path on the server. The files will be read by the api, converted it into bytes and returned as a zip file. Hope, It is clear to you. Please subscribe to the channel if you have not subscribed yet. Thank you.
@chewie9664
@chewie9664 2 жыл бұрын
What would you change if you were pulling this by a guid that is stored in the database?
@azureteachnet
@azureteachnet 2 жыл бұрын
it all depends on where the files are stored.. your question is not so clear. What is the purpose of the guid? do you want to extract the data from database and create files and return it based on the guid?
@chewie9664
@chewie9664 2 жыл бұрын
Yes. Exactly. the files are saved on a hard drive. The name of the files and guid are saved on database. The guid is generated per post call.
@azureteachnet
@azureteachnet 2 жыл бұрын
@@chewie9664 you can query the database by either Entity framework or ADO.net with the GUID and get the filename. If it does not include the path, append the filename with the directory path. Then read the files as it is shown in the video and convert them into the zip file and return it. I hope you are trying to return multiple files as it is shown in the video. If you are looking for returning a single file, the channel has another video for that. Please subscribe to the channel if you have not subscribed yet. Thank you
Swagger Azure AD Client Credentials Flow with  net core web api
27:17
AzureTeach•Net
Рет қаралды 3,5 М.
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Hangfire - Hangfire in .Net Core | Hangfire Asp.Net Core
16:17
Coding Droplets
Рет қаралды 33 М.
Working With The File System in C# - Managing Folders and Files
35:07
How to Download Multiple files as Zip file in ASP.NET Core 7
16:03
Csharp Space
Рет қаралды 1,1 М.
How to download file using Angular 9
10:29
Rui Wang
Рет қаралды 13 М.
How to upload and download files using asp net and c#   Part 139
24:16
Blazor : Upload and Remove Multiple Files Calling Web API || Syncfusion
14:07
Thumb IKR - Programming Examples
Рет қаралды 2,2 М.
I Spent 100 Hours Inside The Pyramids!
21:43
MrBeast
Рет қаралды 69 МЛН
Think Fast, Talk Smart: Communication Techniques
58:20
Stanford Graduate School of Business
Рет қаралды 44 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН