protected void Button1_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { string filename = Path.GetExtension(FileUpload1.FileName); string path = Server.MapPath("upload/"); FileUpload1.SaveAs(path + Guid.NewGuid() + filename); Response.Write("上传成功"); } else { Response.Write("请选择文件"); } } }