使用复选框列表下载多个文件 [英] Downloading Multiple files using checkbox list

查看:56
本文介绍了使用复选框列表下载多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用复选框列表一次从目录列表中下载多个文件.文件名成功显示在列表中,但下载后...该文件夹为空..
以下是填充复选框列表的代码:

Im trying to download multiple files at onces from the directory list using a checkboxlist.The filename successfully appears on the list but upon downloading ...the folder is empty..
Below isthe code to populate the checkboxlist:

string[] files = Directory.GetFiles(Server.MapPath(".") + @"\NewFolder1");


                    chklist.Items.Clear();
                    foreach (string file in files)
                    {

                        chklist.Items.Add(new ListItem(Path.GetFileName(file), file));

                    }


在btndownload下,我有..


Under the btndownload i have..

Response.Clear();

            Response.ContentType = "application/zip";

            Response.AddHeader("content-disposition", "filename=" + "Album.zip");



            using (ZipFile zip = new ZipFile())
            {

                foreach (ListItem item in chklist.Items)
                {

                    if (item.Selected)
                    {

                        zip.AddFile(item.Value, "Album");

                    }

                }

                zip.Save(Response.OutputStream);


任何出现错误的项目..或者任何人都可以纠正我


any item where im goin wrong..or can anyone correct me

推荐答案

您正在用C ++编写网页吗?你最近怎么样?

正如我昨天告诉您的那样,您需要进行一些调试以弄清楚为什么您的zip文件为空.奇怪的原因是您要从一个空文件夹中压缩文件.不要再问同样的事情,尤其是在没有实际执行我们告诉您的操作的情况下.
You''re writing a web page with C++ ? How are you doing that ?

As I told you yesterday, you need to do some debugging to work out why your zip is empty. The odds are the reason is that you''re zipping files from an empty folder. Don''t ask the same thing again, esp without actually doing what we told you to do.


这篇关于使用复选框列表下载多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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