栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > asp

基于ASP.NET+easyUI框架实现图片上传功能(表单)

asp 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

基于ASP.NET+easyUI框架实现图片上传功能(表单)

基于ASP.Net +easyUI框架上传图片,实现图片上传,提交表单:


 
 
 
 
 
 


提交表单的一般处理程序: 

BLL.J_Friendly frend = null;
  Model.J_Friendly fr = null;
  public void ProcessRequest(HttpContext context)
  {
   context.Response.ContentType = "text/plain";
   string command = context.Request["test"].ToString();//前台传的标示值 
   if (command == "add")
   {
    AddFrend(context);
   }
   if (command == "update")
   {
    UpdateFrend(context);
   }
  }

public void AddFrend(HttpContext context)
  {
   frend = new BLL.J_Friendly();
   fr = new Model.J_Friendly();
   string tbName = context.Request.QueryString["tbName"].Trim();
   if (frend.Exists("F_Name='" + tbName + "'"))
   {
    context.Response.Write("{"msg":"添加失败,链接名称与已有的链接名称重复!","success":false}");
    return;
   }
   else
   {

    try
    {
     fr.F_Name = context.Request.QueryString["tbName"].Trim();

    }
    catch
    {
     context.Response.Write("{"msg":"添加失败,请核对信息!","success":false}");
     return;
    }
    try
    {
     string img = context.Request.QueryString["idFile"].Trim();
     if (img == "")
     {
      context.Response.Write("{"msg":"添加失败,请核对图片信息!","success":false}");
      return;
     }
     else
     {
      string str = context.Request.QueryString["idFile"].Trim();
      string str1 = str.Remove(0, str.LastIndexOf("\") + 1);
      fr.F_Img = "../../Upload/Images/" + str1;
     }

    }
    catch
    {
     context.Response.Write("{"msg":"添加失败,请核对信息!","success":false}");
     return;
    }
   }
   if (frend.Add(fr) > 0)
   {
    context.Response.Write("{"msg":"添加成功!","success":true}");
   }
   else
   {
    context.Response.Write("{"msg":"添加失败,请核对信息!","success":false}");
   }
  }

原型图:

 

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/56206.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号