• 怎么在ASp.net中实现图片上传


    阅读全文http://www.cckan.net/forum.php?mod=viewthread&tid=32

    try
            {
                //((Image)gvGradeUser.FindControl(ImageGrade)).ImageUrl.ToString().Trim();
                //根据等级的编修改
                int enbale = 0;
                if (ddlStart.Text.ToString().Trim() == "正常")
                {
                    enbale = 0;
                }
                else
                {
                    enbale = 1;
                }
                //图片存在时
                if (FtxtFlileName.HasFile)
                {
                    FtxtFlileName.SaveAs(Server.MapPath("../GradeImage/") + FtxtFlileName.FileName.ToString().Trim());
                    if (objCusGradelevelService.SetOneGradelevelInfo(Convert.ToInt32(lblcode.Text.ToString().Trim()), txtName.Text.ToString().Trim(), Convert.ToInt32(txtJiFenFanWei.Text.ToString().Trim()), enbale, "~/PersonnelManagement/GradeImage/" + FtxtFlileName.FileName.ToString().Trim(), txtText.Text.ToString().Trim()))
                    {
                        lblMessage.Visible = true;
                        lblMessage.Text = "修改成功";

                    }
                    else
                    {
                        lblMessage.Visible = true;
                        lblMessage.Text = "修改失败";
                    }

                }
                //图片不存在时
                else
                {
                    if (objCusGradelevelService.SetOneGradelevelInfoNoimage(Convert.ToInt32(lblcode.Text.ToString().Trim()), txtName.Text.ToString().Trim(), Convert.ToInt32(txtJiFenFanWei.Text.ToString().Trim()), enbale, txtText.Text.ToString().Trim()))
                    {
                        lblMessage.Visible = true;
                        lblMessage.Text = "修改成功";
                    }
                    else
                    {
                        lblMessage.Visible = true;
                        lblMessage.Text = "修改失败";
                    }
                }
                dt_GradeUser = objCusGradelevelService.GetAllGradelevelInfo();
                dtGradeUser();
                btnAdd.Visible = true;
                btnClearUpdate.Visible = false;
                btnUpdate.Visible = false;
            }
            catch (Exception)
            {
                lblMessage.Visible = true;
                lblMessage.Text = "修改失败";
            }

  • 相关阅读:
    vue3 结合 echarts ,图表初始不渲染,当代码改变后才会渲染
    vue3结合three.js 展示3d模型时, 从a路由跳转到b路由,浏览器后退到a路由时,模型加载完后一片空白,并且自定义的CSS2DObject 标签 重复出现
    win7下安装nodejs16.4.0
    数据挖掘模型学习二分类
    真是人生无常,大肠包小肠
    sql优化
    第一个SpringMVC小案例
    (CVE202223131)ZABBIX绕过 SAML SSO 身份验证
    python openpyxl打开xlsx文件异常,UserWarning: File contains an invalid specification for Sheet1. This will be removed
    使用frp实现内网穿透
  • 原文地址:https://www.cnblogs.com/sufei/p/1485997.html
Copyright © 2020-2023  润新知