- 关 键 词:
- asp.net
private Boolean SaveFiles()
{
//得到File表单元素
HttpFileCollection files = HttpContext.Current.Request.Files;
try
{
for(int intCount= 0; intCount< files.Count; intCount++)
{
HttpPostedFile postedFile = files[intCount];
string fileName, fileExtension;
//获得文件名字
fileName = System.IO.Path.GetFileName(postedFile.FileName);
if (fileName != "")
{
//获得文件名扩展
fileExtension = System.IO.Path.GetExtension(fileName);
//可根据不同的扩展名字,保存文件到不同的文件夹
//注意:可能要修改你的文件夹的匿名写入权限。
postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("upFiles/") + fileName);
}
}
return true;
}
catch(System.Exception Ex)
{
return false;
}
}本文:http://www.qqread.com/aspdotnet/e682490000.html
更多内容请看.NET移动与嵌入式技术、.NET开发手册、ASP.NET教程专题,或进入讨论组讨论。
{
//得到File表单元素
HttpFileCollection files = HttpContext.Current.Request.Files;
try
{
for(int intCount= 0; intCount< files.Count; intCount++)
{
HttpPostedFile postedFile = files[intCount];
string fileName, fileExtension;
//获得文件名字
fileName = System.IO.Path.GetFileName(postedFile.FileName);
if (fileName != "")
{
//获得文件名扩展
fileExtension = System.IO.Path.GetExtension(fileName);
//可根据不同的扩展名字,保存文件到不同的文件夹
//注意:可能要修改你的文件夹的匿名写入权限。
postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("upFiles/") + fileName);
}
}
return true;
}
catch(System.Exception Ex)
{
return false;
}
}本文:http://www.qqread.com/aspdotnet/e682490000.html
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- .NET移动与嵌入式技术 (5950篇文章)
- .NET开发手册 (5652篇文章)
- ASP.NET教程 (8422篇文章)
- .NET实用开发 (1678篇文章)
- ASP.NET应用篇 (2631篇文章)
- asp.net动态设置WebService引用 (22次浏览)
- 安全接口 interface --显示实现接口 (16次浏览)
- .net程序员的盲点(一):ref,out ,params的区别 (11次浏览)
- .net程序员的盲点(二):两个“属性”引起的歧义 (9次浏览)
- .net Framework 2.0下发送邮件的方式 (8次浏览)
- .NET开发人员犯的6大安全错误 (6次浏览)
- 使用正则表达式Replace (5次浏览)
- ASP.NET WebForm Best Practice 之ViewState (5次浏览)
- ASP.NET里的支架:Dynamic Data Support (4次浏览)
- 请跟我来--使用Ext搞个原型 (1次浏览)



