如何使用asp.net从数据库下载多个图像 [英] how can download multiple images from database using asp.net

查看:72
本文介绍了如何使用asp.net从数据库下载多个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用vs2008,asp.net,c#和sqlserver.

我下面有一个下载单个图像表单数据库的代码.

Hi All,

I am using vs2008,asp.net,c# and sqlserver.

I have a code thats download single image form database in below.

protected void Page_Load(object sender, EventArgs e)
        {
            // Get the file id from the query string
            int id = Convert.ToInt16(Request.QueryString["ID"]);

            // Get the file from the database
            DataTable file = FileUtilities.GetAFile(id);
            DataRow row = file.Rows[0];

            string name = (string)row["Name"];
            string contentType = (string)row["ContentType"];
            Byte[] data = (Byte[])row["Data"];

            // Send the file to the browser
            Response.AddHeader("Content-type", contentType);
            Response.AddHeader("Content-Disposition", "attachment; filename=" + name);
            Response.BinaryWrite(data);
            Response.Flush();
            Response.End();
        } 



但是我需要如何从数据库下载多个图像,并且图像应保存在任何驱动器的文件夹中.

帮助将不胜感激,给任何想法或链接

问候
mukesh



But i need to how can download multiple images from database and images should be saved in folder of any drive.

help will be appreciated, give any idea or link

Regards
mukesh

推荐答案

您无法一次下载多个图像.但是,您需要编写代码以首先创建一个zip文件,然后将所有这些文件添加到zip文件中,然后再下载zip文件.

在此链接中,您可以找到相同的更多详细信息

在.NET中创建Zip存档(无需使用SharpZipLib之类的外部库) [ ^ ]

谢谢,
Imdadhusen
You can not download multiple images at single click. however you need to write code for first create a zip files and add all those files into zip and then download zip file.

Here is the link where you can find more details for same

Creating Zip archives in .NET (without an external library like SharpZipLib)[^]

Thanks,
Imdadhusen


这篇关于如何使用asp.net从数据库下载多个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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