利用jQuery实现多文件上传

 protected void btnUpload_Click(object sender, EventArgs e)
    {
        
try
        {
            
// 获取文件列表
            HttpFileCollection hfc = Request.Files;
            
for (int i = 0; i < hfc.Count; i++)
            {
                HttpPostedFile hpf 
= hfc[i];
                
if (hpf.ContentLength > 0)
                {
                    hpf.SaveAs(Server.MapPath(
"MyFiles"+ "\\" +
                      System.IO.Path.GetFileName(hpf.FileName));
                    Response.Write(
"<b>文件: </b>" + hpf.FileName + " <br/> <b>大小:</b> " +
                        hpf.ContentLength 
+ " <br/>  <b>类型:</b> " + hpf.ContentType + " 上传成功! <br/>");
                }
            }
        }
        
catch (Exception ex)
        {
            
        }
    }

 

 利用jQuery实现文件上传功能

 

posted @ 2010-03-19 15:09  smodi  阅读(328)  评论(0编辑  收藏  举报