如何用一个<INPUT type="file">实现多图片上传?类似于:http://beijing.263.com/Send1.aspx?SortID=65在线等~~~~~~~很着急~~~~~~~~~~

解决方案 »

  1.   

    private void uploadfile() 

    string finfo=""; 
    for (int i = 0; i <= Request.Files.Count - 1; i++) 

    HttpPostedFile PostedFile = Request.Files[i]; 
    if (PostedFile.ContentLength > 0) 

    string _int; 
    if (PostedFile.ContentLength / 1024 > 1024) 

    _int = PostedFile.ContentLength / 1024 / 1024 + " MB"; 

    else if (PostedFile.ContentLength / 1024 > 1024) 

    _int = PostedFile.ContentLength / 1024 + " KB"; 

    else 

    _int = PostedFile.ContentLength + "字节"; 

    finfo = finfo + "文件名称:" + PostedFile.FileName + "<br>"; 
    finfo = finfo + "文件大小:" + _int + "<br>"; 
    finfo = finfo + "文件类型:" + PostedFile.ContentType + "<br>"; 
    string[] filesplit = PostedFile.FileName.Split('\\'); 
    string Filename = filesplit[filesplit.Length - 1]; 
    if (Request["dir"]==null)
    {
    string path=Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["UP"]);
    PostedFile.SaveAs(path + Filename); 
    Response.Redirect("Admin_Serverlist.aspx?dir="+path);
    }
    else
    {
    PostedFile.SaveAs(Request["dir"] +"\\"+ Filename); 
    Response.Redirect("Admin_Serverlist.aspx?dir="+Request["dir"]);
    }

    }
    fileinfo.InnerHtml = finfo; 
    }