Which file method are you using In the last line return File(outstretched.ToArray(),...)
@azureteachnet Жыл бұрын
That is default Web API File method which returns FileResult. Please subscribe to the channel if you have not subscribed yet. Thanks.
@gideonzweijtzer51572 жыл бұрын
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.
@azureteachnet2 жыл бұрын
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.
@vishal8152 жыл бұрын
But u r giving path into it how we can set because it is going to download in client machine, thanks
@azureteachnet2 жыл бұрын
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.
@chewie96642 жыл бұрын
What would you change if you were pulling this by a guid that is stored in the database?
@azureteachnet2 жыл бұрын
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?
@chewie96642 жыл бұрын
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.
@azureteachnet2 жыл бұрын
@@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