Beispiel #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string P_str_filePath = "", P_str_fileExtName = "", P_str_mFileName, P_str_mPath;

        if ("" != uploadImg.FileName)
        {
            P_str_filePath    = uploadImg.PostedFile.FileName;                                 //获取文件路径
            P_str_fileExtName = P_str_filePath.Substring(P_str_filePath.LastIndexOf(".") + 1); //获得扩展名
            try
            {
                P_str_mPath     = Server.MapPath("/images/");                                     //保存到指定的路径
                P_str_mFileName = P_str_filePath.Substring(P_str_filePath.LastIndexOf("\\") + 1); //获得文件的名称
                uploadImg.PostedFile.SaveAs(P_str_mPath + P_str_mFileName);                       //保存到指定的路径
                string  com = "update MEMBERS set PHOTO='/images/" + (P_str_mFileName) + "',TEL='" + this.telephone.Text + "',QQ='" + this.QQ.Text + "',WECHAT='" + this.wechat.Text + "',INTRO='" + this.intro.Text + "' where MID=00020030";
                sqlData da  = new sqlData();
                da.ExceSQL(com);
            }
            catch (Exception err)
            {
                Response.Write(err.ToString());
            }
        }
        Response.Redirect("/members/Tech-department1.aspx");
    }