用 System.IO.Directory 类/// <summary>
/// 获取文件集合
/// </summary>
/// <param name="fullPath">当前目录路径</param>
/// <returns></returns>
public FileInfo[] GetFiles( string fullPath )
{
DirectoryInfo curDir = new DirectoryInfo( fullPath );
FileInfo[] fileInfo = curDir.GetFiles();
return fileInfo;
}取后缀名为.gif, .jpg ,等结尾的文件。这样很简单就可以知道你这些图片的路径。
给 image 控件赋值路径。

解决方案 »

  1.   

    得到图片并显示如楼上所言,如果想要一下子全部下载,用Response.WriteFile就可以了
      

  2.   

    请xrascal(横刀夺爱) 和 alick0214(剑心)说详细一点,我不太明白。
      

  3.   

    //原理和(横刀夺爱)一样
    public static void AttachImage( Page form, string szPath )
    { string[] szFiles = Directory.GetFiles( szPath, "*.jpg" ); int pos = -1;
    string szOriginalImagePath = string.Empty; //form
    form.Response.Write( "<br><br><br><br><hr>" ); foreach( string szFilePath in szFiles )
    {
        System.Web.UI.WebControls.Image webImg = new System.Web.UI.WebControls.Image();
        System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label();     pos = szFilePath.LastIndexOf('\\');
        szOriginalImagePath = szFilePath.Substring( pos + 1 );
        webImg.ImageUrl = "name\picture\pic\che\" + szOriginalImagePath;
        webImg.Width = 88;
        webImg.Height = 58;

        lbl.Text = "&nbsp;&nbsp;";     form.Controls.Add( webImg );
        form.Controls.Add( lbl );
    }
    }//调用,比如
    private void Page_Load(object sender, System.EventArgs e)
    {
        // Put user code to initialize the page here
        AttachImage( this, Server.MapPath(".\name\picture\pic\che\") );
    }