简体   繁体   中英

allowing users to download files from azure blob storage as single zip file

I have multipl files in my blob storage. Also I have a azure database table which stores url which points to actual individual files in blob storage . On my webform user can specify search criteria.Then it will search for files that match the search condition and show a single link to download matching files all as a single zip file. I have my search results returned as a list. for example
List searchresults

This search result will contain multiple urls eg.,searchresults.url ="https://myblobstorage.blob.windows.net\\xyz\\mymusic.mp3"

if there are matching records ,it will show a single download link on the page,so that the user can click on the link and download the the matching files together as as single zip file.

I am able generate the searchresultsList with the required file urls pointing to the files in my azure blob container.

Now my Question Is there a way I can generate a zip file by looping through the searchresultsList and grabbing files from blob and generate a single zip file for the user to download them? Give me your suggestions or some sample code to achieve this functionality.

When the user clicks on the link, it should go and fetch all the files from corresponding urls from the search results list and generate a single zip file and download to the users machine

You need to download the blobs to your server, generat a zip and push that to the client.

You can use the following lib to generate the zip file http://dotnetzip.codeplex.com/

The blobs you can download to the client via the .NET SDK provided with the Azure framework. It should be a simple solution, really.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM