protected void Button1_Click1(object sender, EventArgs e)
    {
        string filePath = "d://";
        HttpFileCollection upfiles = Request.Files;

        for (int i = 0; i < upfiles.Count; i++)
        {
            HttpPostedFile file = upfiles[i];

            if (file.ContentLength > 0)
            {
                file.SaveAs(filePath + Path.GetFileName(file.FileName));


                Response.Write(Path.GetFileName(file.FileName));
            }
        }
    }

 

以上是主要代码,细节判断不表。

 


本文转载:CSDN博客