基于ASP.Net +easyUI框架上传图片,实现图片上传,提交表单:
<body> <link href="../../Easyui/themes/easyui.css" rel="stylesheet" type="text/css" /> <script charset="utf-8" src="/UploadFiles/2021-04-02/jquery.easyui.min.js">提交表单的一般处理程序:
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}"); } }原型图:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
最新资源
- 白嘉倩.1992-我有我【星工厂】【WAV+CUE】
- 黎明.2006-LOOKING【东亚唱片】【WAV+CUE】
- 群星.1986-国语金曲尽精英【瑞成】【WAV+CUE】
- 長渕剛《Blood》[FLAC/分轨][299.09MB]
- 群星《歌手2024 第4期》[320K/MP3][107.39MB]
- 群星《歌手2024 第4期》[FLAC/分轨][563.76MB]
- RiffKitten-ChaosParade(2024)[24-44,1]FLAC
- RuneKlakegg-Nattevandrer(2024)[24-96]\FLAC
- 赖冰霞.2006-金嗓典藏辑2IN1(南方金点系列)2CD【
- 群星.1988-国语金曲尽精英VOL.2【瑞成】【WAV+C