谁能给点多文件上传的例子,谢谢啦
------解决方案--------------------------------------------------------
public static string CreateUploadFile(string FileOlder)
{
HttpPostedFile postedfile;
HttpFileCollection file1 = HttpContext.Current.Request.Files;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
st.Start();
for (int i = 0; i < file1.Count; i++)
{
postedfile = HttpContext.Current.Request.Files[i];
//获取文件的扩展名
FileEx=Path.GetExtension(postedfile.FileName);
//追加文件名
////定义文件名以时间命名加上文件扩展名
string saveFile= DateTime.Now.ToString("yyyyMMddHHmmss")+st.ElapsedTicks.ToString() + FileEx;
sb.Append(saveFile);
sb.Append(",");
//保存文件
postedfile.SaveAs(HttpContext.Current.Server.MapPath(FileOlder + "/") + saveFile);
}
if(sb.Length>0)
sb.Remove(sb.Length-1, 1);
st.Stop();
return sb.ToString();
}