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

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}"); } }

原型图:

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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjyxgy.html