在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());
}
}
解决方案 »
- action里取不到form的值
- dataGridView不绑定数据库,增加行怎么会把前面的数据清除掉的,奇怪
- 使用listview显示本机安装的应用程序的问题
- 请教在DataGridView中怎样生成自适应的列宽?
- 如何验证ip地址,并且带端口号的,谢谢?
- 关于分辨率的问题,请大家帮助?
- vs2005水晶报表
- 怎么使用windows Media Player控件?
- 在DataGrid中怎么让某一行不能够被编辑阿,也就是设置行的readonly, 谢谢哥哥指点了
- 请问如何不刷新页面而取到树状列表的选择的node的值???急
- 隐藏winform中的最小化最大化关闭按钮,并且显示窗体图标
- XPath,怎么取没有name属性的节点。
不是啊 就是1 选中好几个文件开始上传的时候就是1个能上传上去