protected void Button1_Click(object sender, EventArgs e) { UploadIMG m_upload = new UploadIMG(); m_upload.Path = @"..\MainSite\WebResources\ArticleImg\"; m_upload.IsThumbnail = false; try { if (m_upload.UpLoadIMG(FileUpload1)) { Image1.ImageUrl = AppConfig.WebResourcesPath()+"ArticleImg/" + m_upload.OFileName; Image1.Visible = true; TextBox1.Text = AppConfig.WebResourcesPath() + "ArticleImg/" + m_upload.OFileName; TextBox1.Visible = true; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('" + m_upload.MSG + "');", true); } } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true); } }
/// <summary> /// 上传头像 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { UploadIMG m_upload = new UploadIMG(); m_upload.Path = @"WebResources\UpUserFiles\Photos\Tmp"; m_upload.IsThumbnail = false; try { if (m_upload.UpLoadIMG(FileUpload1)) { ImageDrag.ImageUrl = "~/ControlLibrary/ShowPhoto.aspx?type=tmp&id="+ m_upload.OFileName.Replace("o", ""); ImageIcon.ImageUrl = "~/ControlLibrary/ShowPhoto.aspx?type=tmp&id=" + m_upload.OFileName.Replace("o", ""); hdfPicID.Value = m_upload.OFileName.Replace("o", ""); MultiView1.ActiveViewIndex = 4; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('"+m_upload.MSG+"');", true); } } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true); } }