我有一个asp文件上传,启用了AllowMultiple =“true”。如何显示用户所选文件的文件名?
答案 0 :(得分:3)
您可以使用此代码:
protected void uploadFile_Click(object sender, EventArgs e)
{
if (UploadImages.HasFiles)
{
foreach (HttpPostedFile uploadedFile in UploadImages.PostedFiles)
{
uploadedFile.SaveAs(System.IO.Path.Combine(Server.MapPath("~/Images/"),
uploadedFile.FileName));
listofuploadedfiles.Text += String.Format("{0}<br />", uploadedFile.FileName);
}
}
}