在IE中一次选中多个文件进行上传(不是多个FILE框进行选择),如有人提供原代码和控件者价格可以商量!

解决方案 »

  1.   

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.IO;
    using System.Text;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.Xml;
    using Bestcomy.Web.Controls.Upload;namespace AspNetUpload
    {
    /// <summary>
    /// MultiUpload 的摘要说明。
    /// </summary>
    public class MultiUpload : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.TextBox box_comments;
    protected System.Web.UI.WebControls.Label txt_result;
    protected System.Web.UI.WebControls.Button btn_upload;

    private void Page_Load(object sender, System.EventArgs e)
    {
    BestcomyUpload upldr = new BestcomyUpload();
    upldr.RegisterProgressBar("ProgressBar.aspx",btn_upload); //注册上传进度条。
    string fpath = Path.Combine(Server.MapPath("."),"Upload");
    if(!Directory.Exists(fpath))
    Directory.CreateDirectory(fpath);
    upldr.UploadFolder=fpath; //设置上传文件临时目录,要求ASPNET用户对该文件夹有写权限。
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.btn_upload.Click += new System.EventHandler(this.btn_upload_Click);
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion /// <summary>
    /// 获取最大可上传文件大小。
    /// </summary>
    /// <returns></returns>
    protected double GetMaxRequestLength()
    {
    double maxLength=0;
    string sPath = typeof(String).Assembly.Location;
    sPath = Path.GetDirectoryName(sPath);
    sPath = Path.Combine(sPath,"CONFIG\\machine.config");
    XmlDocument doc=new XmlDocument();
    doc.Load(sPath);
    maxLength=Convert.ToDouble(doc.SelectSingleNode("configuration/system.web/httpRuntime/@maxRequestLength").Value);

    doc.Load(Path.Combine(Request.PhysicalApplicationPath,"web.config"));
    XmlNode node=doc.SelectSingleNode("configuration/system.web/httpRuntime/@maxRequestLength");
    if(node!=null)
    {
    double length=Convert.ToDouble(node.Value);
    if(length<maxLength)
    maxLength=length;
    } return maxLength/1024;
    } private void btn_upload_Click(object sender, System.EventArgs e)
    {
    string fpath = Path.Combine(Server.MapPath("."),"Upload"); StringBuilder sb = new StringBuilder();
    sb.Append("<hr>说明文字:"+box_comments.Text+"<br>");
    sb.Append("上传文件列表:<br>");
    sb.Append("<table border='1'>");
    sb.Append("<tr><td>文件名</td><td>大小</td></tr>"); BestcomyUpload upldr = new BestcomyUpload();
    foreach(UploadFile file in upldr.GetUploadFiles("file1"))
    {
    file.SaveAs(Path.Combine(fpath,Path.GetFileName(file.FileName)));
    sb.Append("<tr><td>"+Path.GetFileName(file.FileName)+"</td><td>"+file.ContentLength.ToString("###,###")+"&nbsp;字节</td></tr>");
    }
    sb.Append("<table>");
    txt_result.Text = sb.ToString();
    }
    }
    }
      

  2.   

    http://blog.csdn.net/shoutor/archive/2004/11/08/172013.aspx