🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
第二步,编写后台代码。 **注意,以下仅是算法描述,你可以使用asp.net、jsp、php等任何web框架,来实现该程序**。 >请注意算法描述中**标注『重要』的部分**。 ```C# //重要:类型必须是 "text/html" response.ContentType = "text/html"; response.Charset = "utf-8"; //获取第一步中得到的 wangEditor_uploadImg_assist.html 页面的url地址 string assitUrl = "http://localhost:8080/wangEditor_uploadImg_assist.html"; //获取文件对象 File file = request.Files[0]; //重要:你可以可以通过 File file = request.Files["wangEditor_uploadImg"]; 来获取文件对象 //重要:用该方法获取时,key必须写“wangEditor_uploadImg”,否则出错 //验证、保存文件,省略此处代码 if(success) { //如果保存成功 //重要:获取图片的url地址 string imgUrl = ...省略此处代码...; //重要:assitUrl 即 wangEditor_uploadImg_assist.html 的url地址 //重要:别忘了“ok|” string iframeSrc = assitUrl + "#" + "ok|" + imgUrl; //拼接最终结果 string result = "<iframe src=\"" + iframeSrc + "\"></iframe>"; //返回 response.Write(result); response.End(); return; } else { //如果失败 //重要:此处的“上传失败”可随意填写 string iframeSrc = assitUrl + "#" + "上传失败"; string result = "<iframe src=\"" + iframeSrc + "\"></iframe>"; response.Write(result); response.End(); return; } ```