您现在的位置是:网站首页> 编程资料编程资料
基于ASP.NET+easyUI框架实现图片上传功能(表单)_实用技巧_
2023-05-24
364人已围观
简介 基于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}"); } } 原型图:

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
您可能感兴趣的文章:
相关内容
- ASP.NET通过第三方网站Bitly实现短链接地址程序_实用技巧_
- ASP.NET配合jQuery解决跨域调用的问题_实用技巧_
- Aspose.Cells 读取受保护有密码的Excel文件_实用技巧_
- ASP.NET web.config 配置节点详解_基础应用_
- 使用PowerShell .Net获取电脑中的UUID_实用技巧_
- ABP框架中导航菜单的使用及JavaScript API获取菜单的方法_实用技巧_
- asp.net(C#)使用QRCode生成图片中心加Logo或图像的二维码实例_实用技巧_
- asp.net及javascript判断是否手机访问的方法_实用技巧_
- 微信公众平台开发之发送文本消息.Net代码解析_实用技巧_
- 利用ASP.NET MVC+Bootstrap搭建个人博客之修复UEditor编辑时Bug(四)_实用技巧_
