我有两个文件上传控件 这是保存多个文件的代码 C# string filepath = Server.MapPath(“〜// Files / Documents / test /”); HttpFileCollection uploadedFiles = Request.Files;
//Span1.Text = string.Empty;
for (int i = 0; i < uploadedFiles.Count; i++)
{
HttpPostedFile userPostedFile = uploadedFiles[i];
try
{
if (userPostedFile.ContentLength > 0)
{
Response.Write(userPostedFile.FileName);
userPostedFile.SaveAs(filepath + Path.GetFileName(userPostedFile.FileName));
//Span1.Text += "Location where saved: " + filepath + "\\" + Path.GetFileName(userPostedFile.FileName) + "<p>";
}
}
catch (Exception Ex)
{
//Span1.Text += "Error: <br>" + Ex.Message;
}
}