从asp.net中的gridview同时下载多个文件 [英] Download Multiple files Simultaneously from gridview in asp.net

查看:71
本文介绍了从asp.net中的gridview同时下载多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI全部,



我将本地系统文件上传到服务器,我存储在服务器的文件夹中。我在gridview中显示文件名现在我想通过选择基于我想要从服务器下载文件到本地系统的复选框来下载多个文件。我一次只能下载单个文件,但我想从服务器下载多个文件到本地系统。



我将等待你的回复。



谢谢

PBN

解决方案

只有一种方式,你会有在服务器端压缩它们然后下载zip文件。



你可以试试这个 SharpZipLib [ ^ ]这是一个C#的开源归档库。



基本上,应遵循以下步骤:



1)将每个项目从网格中添加,即文件名逐一检查列表。

2)对于每个文件名,在其前面添加基本路径(在您的基础上)服务器)并使用ZipLib将其添加到存档文件,即拉链。

3)fi nally,将zip文件保存到磁盘。

4)将客户端重定向到zip文件的位置,浏览器将负责其余部分。



我知道它不是完整的代码,但你很少会在CP上获得完整的代码,除非它非常小。但这应该给你一个方法。


查看multiDownload jquery插件: http:// biesiad .github.com / multiDownload / [ ^ ]

HI All,

I am uploading local system file to server and I am storing in server''s folder. I am displaying file name in gridview Now I want to download multiple file by selecting checkboxes based on that I want download files from server to local system. I am able donwload single file at a time but I want to download multiple files from server to local system.

I will be waiting for your reply.

Thanks
PBN

解决方案

There is only one way mate, you are gonna have to zip them up on server side and then download the zip file.

You can try this SharpZipLib[^] which is an open source archiving library for C#.

Essentially, the following steps should be followed:

1) Add each item from the grid i.e. filename to a list as you check them one by one.
2) For each filename, prefix it with the base path (on your server) and using ZipLib add it to an archive file i.e. a zip.
3) finally, save zip file to the disk.
4) Redirect the client to the location of the zip file and browser will take care of the rest.

I know its not full code but you will rarely get full code on CP, unless its quite small. But this should give u an approach.


Check out the multiDownload jquery plugin: http://biesiad.github.com/multiDownload/[^]


这篇关于从asp.net中的gridview同时下载多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆