在web里边Page.Request.Files.Count 获取的文件数量怎么是1啊!求高人指点这是源码:
Response.CacheControl = "no-cache";
string s_rpath =@"E:\My Documents\Visual Studio 2008\WebSites\SWFUpload\demos\applicationdemo.net";
string Datedir = DateTime.Now.ToString("yy-MM-dd");
string updir = s_rpath + "\\" + Datedir;
//string tempFile = Request.PhysicalApplicationPath;
if (this.Page.Request.Files.Count > 0)
{
try
{ for (int j = 0; j < this.Page.Request.Files.Count; j++)
{ HttpPostedFile uploadFile = this.Page.Request.Files[j]; if (uploadFile.ContentLength > 0)
{
if (!Directory.Exists(updir))
{
Directory.CreateDirectory(updir);
}
string extname = Path.GetExtension(uploadFile.FileName);
string fullname=DateTime.Now.Year.ToString()+DateTime.Now.Month.ToString()+DateTime.Now.Day.ToString()+ DateTime.Now.Hour.ToString()+DateTime.Now.Minute.ToString()+DateTime.Now.Second.ToString();
string filename = uploadFile.FileName; uploadFile.SaveAs(string.Format("{0}\\{1}", updir, filename));
}
}
}
catch (Exception ex)
{
Response.Write("Message"+ ex.ToString());
}
}
Response.CacheControl = "no-cache";
string s_rpath =@"E:\My Documents\Visual Studio 2008\WebSites\SWFUpload\demos\applicationdemo.net";
string Datedir = DateTime.Now.ToString("yy-MM-dd");
string updir = s_rpath + "\\" + Datedir;
//string tempFile = Request.PhysicalApplicationPath;
if (this.Page.Request.Files.Count > 0)
{
try
{ for (int j = 0; j < this.Page.Request.Files.Count; j++)
{ HttpPostedFile uploadFile = this.Page.Request.Files[j]; if (uploadFile.ContentLength > 0)
{
if (!Directory.Exists(updir))
{
Directory.CreateDirectory(updir);
}
string extname = Path.GetExtension(uploadFile.FileName);
string fullname=DateTime.Now.Year.ToString()+DateTime.Now.Month.ToString()+DateTime.Now.Day.ToString()+ DateTime.Now.Hour.ToString()+DateTime.Now.Minute.ToString()+DateTime.Now.Second.ToString();
string filename = uploadFile.FileName; uploadFile.SaveAs(string.Format("{0}\\{1}", updir, filename));
}
}
}
catch (Exception ex)
{
Response.Write("Message"+ ex.ToString());
}
}
不是啊 就是1 选中好几个文件开始上传的时候就是1个能上传上去