******************************************************************************* using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using MWO.Model.Info; using MWO.DAL.Info; public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void ButtonUp_Click(object sender, EventArgs e) { if (FileUpload1.PostedFile.FileName != null) { try { FileName.InnerHtml = FileUpload1.PostedFile.FileName;//GetPhotoName UpDateTime.InnerHtml = DateTime.Now.ToShortDateString();//UpDateTime #region SetPhotoSize FileLength.InnerHtml = CountSize(FileUpload1.PostedFile.ContentLength); if (FileUpload1.PostedFile.ContentLength > 1024 * 1024 * 2) { Response.Write("<script>alert('图片不能超过规定大小!');</script>"); } else { #region SetPhotoFormat FileType.InnerHtml = FileUpload1.PostedFile.ContentType; FileExtention.InnerHtml = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName).ToUpper(); string m_FileName = "www.MWO.Com-" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-ffff").Replace(".", "-") + FileExtention.InnerHtml; string m_sFileName = "www.MWO.Com-" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-ffff").Replace(".", "-") + FileExtention.InnerHtml; if (FileExtention.InnerHtml == ".JPG") { string m_SavePath = Server.MapPath("./photo/") + m_FileName; SaveDir.InnerHtml = m_SavePath; |