温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:三层班级留言本源码
当前文件路径:ClassSay/Class/AddImage.aspx.cs

1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.IO; 12
public partial class AddImage : System.Web.UI.Page 13
{ 14
protected void Page_Load(object sender, EventArgs e) 15
{ 16
17
} 18
19
protected void btnUpload_Click(object sender, EventArgs e) 20
{ 21
HttpFileCollection FileList = HttpContext.Current.Request.Files; 22
try 23
{ 24
for (int Index = 0; Index < FileList.Count; Index++) 25
{ 26
HttpPostedFile file = FileList[Index]; 27
string FileName = Path.GetFileName(file.FileName); 28
string FileExtersion = Path.GetExtension(file.FileName); 29
file.SaveAs(this.MapPath("bodyImages") + "//" + FileName); 30
//Session["body"] = Session["body"].ToString() + "<img/>"; 31
} 32
} 33
catch (Exception exp) 34
{ 35
throw new Exception(exp.Message); 36
} 37
} 38
} 39





}
}