相关资源
搜索
广告是为了发展
在ASP.NET中实现多文件上传
作者:不详 来源:网络 编辑:阿志
C# 版本
UpLoad.aspx
UpLoad.aspx.cs
"); try { for(int iFile = 0; iFile < files.Count; iFile++) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[iFile]; string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); if (fileName != "") { fileExtension = System.IO.Path.GetExtension(fileName); strMsg.Append("上传的文件类型:" + postedFile.ContentType.ToString() + "
"); strMsg.Append("客户端文件地址:" + postedFile.FileName + "
"); strMsg.Append("上传文件的文件名:" + fileName + "
"); strMsg.Append("上传文件的扩展名:" + fileExtension + "
"); ///'可根据扩展名字的不同保存到不同的文件夹 ///注意:可能要修改你的文件夹的匿名写入权限。 postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("images/") + fileName); } } strStatus.Text = strMsg.ToString(); return true; } catch(System.Exception Ex) { strStatus.Text = Ex.Message; return false; } } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } ///
--------------------------------------------------------------------------www.Cbcz.com
