做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當(dāng)前位置: 首頁 - 科技 - 知識(shí)百科 - 正文

asp.net core集成kindeditor實(shí)現(xiàn)圖片上傳功能

來源:懂視網(wǎng) 責(zé)編:小OO 時(shí)間:2020-11-27 22:36:24
文檔

asp.net core集成kindeditor實(shí)現(xiàn)圖片上傳功能

本文為大家分享了asp.net core 如何集成kindeditor并實(shí)現(xiàn)圖片上傳功能的具體方法,供大家參考,具體內(nèi)容如下:準(zhǔn)備工作;1.visual studio 2015 update3開發(fā)環(huán)境。2.net core 1.0.1 及以上版本。目錄;新建asp.net core web項(xiàng)目。下載kindeditor。增加圖片上傳控制器;配置kindeditor參數(shù)。代碼下載;新建asp.net core web項(xiàng)目。新建一個(gè)asp.net core項(xiàng)目,這里命名為kindeditor。選中web應(yīng)用程序;下載kindeditor。這里我們新建了一個(gè)系統(tǒng)自帶的樣本項(xiàng)目,去 kindeditor官網(wǎng)下載一個(gè)版本,解壓后拷貝大wwwroot中。修改views/index.cshtml。
推薦度:
導(dǎo)讀本文為大家分享了asp.net core 如何集成kindeditor并實(shí)現(xiàn)圖片上傳功能的具體方法,供大家參考,具體內(nèi)容如下:準(zhǔn)備工作;1.visual studio 2015 update3開發(fā)環(huán)境。2.net core 1.0.1 及以上版本。目錄;新建asp.net core web項(xiàng)目。下載kindeditor。增加圖片上傳控制器;配置kindeditor參數(shù)。代碼下載;新建asp.net core web項(xiàng)目。新建一個(gè)asp.net core項(xiàng)目,這里命名為kindeditor。選中web應(yīng)用程序;下載kindeditor。這里我們新建了一個(gè)系統(tǒng)自帶的樣本項(xiàng)目,去 kindeditor官網(wǎng)下載一個(gè)版本,解壓后拷貝大wwwroot中。修改views/index.cshtml。

本文為大家分享了asp.net core 如何集成kindeditor并實(shí)現(xiàn)圖片上傳功能的具體方法,供大家參考,具體內(nèi)容如下

準(zhǔn)備工作

1.visual studio 2015 update3開發(fā)環(huán)境

2.net core 1.0.1 及以上版本

目錄

新建asp.net core web項(xiàng)目

下載kindeditor

增加圖片上傳控制器

配置kindeditor參數(shù)

代碼下載

新建asp.net core web項(xiàng)目

新建一個(gè)asp.net core項(xiàng)目,這里命名為kindeditor

選中web應(yīng)用程序

下載kindeditor

這里我們新建了一個(gè)系統(tǒng)自帶的樣本項(xiàng)目,去 kindeditor官網(wǎng)下載一個(gè)版本,解壓后拷貝大wwwroot中

修改views/index.cshtml

@{
 ViewData["Title"] = "Home Page";
}
<link href="~/kindeditor/themes/default/default.css" rel="stylesheet" />
<script src="~/kindeditor/kindeditor-min.js"></script>
<script src="~/kindeditor/lang/zh_CN.js"></script>
 
<div class="row">
 <textarea id="detail_desc" name="detail_desc" style="width:700px;height:300px;">
 
 </textarea> 
</div>
<script type="text/javascript">
 //實(shí)例化編輯器
 //建議使用工廠方法getEditor創(chuàng)建和引用編輯器實(shí)例,如果在某個(gè)閉包下引用該編輯器,直接調(diào)用UE.getEditor('editor')就能拿到相關(guān)的實(shí)例
 KindEditor.ready(function (K) {
 window.editor = K.create('#detail_desc', {
 width: '98%',
 height: '500px'
 });
 }); 
</script>

運(yùn)行一下現(xiàn)在就可以看到kindeditor已經(jīng)集成進(jìn)來了。

增加圖片上傳控制器

注意返回是一個(gè)json對(duì)象,因此建了一個(gè)簡(jiǎn)單的對(duì)象返回。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using Microsoft.Net.Http.Headers;
using Microsoft.AspNetCore.Hosting;
using System.IO;
namespace kindeditortest.Controllers
{
 public class HomeController : Controller
 {
 private IHostingEnvironment hostingEnv;
 public IActionResult Index()
 {
 return View();
 }
 public HomeController(IHostingEnvironment env)
 {
 this.hostingEnv = env;
 }
 /// <summary>
 /// Kindeditor圖片上傳
 /// </summary>
 /// <param name="imgFile">Kindeditor圖片上傳自帶的命名,不可更改名稱</param>
 /// <param name="dir">不可更改名稱 這里沒有用到dir</param>
 /// <returns></returns>
 public IActionResult KindeditorPicUpload(IList<IFormFile> imgFile, string dir)
 {
 PicUploadResponse rspJson = new PicUploadResponse() { error = 0, url = "/upload/" };
 long size = 0;
 string tempname = "";
 foreach (var file in imgFile)
 {
 var filename = ContentDispositionHeaderValue
 .Parse(file.ContentDisposition)
 .FileName
 .Trim('"');
 var extname = filename.Substring(filename.LastIndexOf("."), filename.Length - filename.LastIndexOf("."));
 var filename1 = System.Guid.NewGuid().ToString() + extname;
 tempname = filename1;
 var path = hostingEnv.WebRootPath;
 filename = hostingEnv.WebRootPath + $@"\upload\{filename1}";
 size += file.Length;
 using (FileStream fs = System.IO.File.Create(filename))
 {
 file.CopyTo(fs);
 fs.Flush();
 //這里是業(yè)務(wù)邏輯
 }
 }
 rspJson.error = 0;
 rspJson.url = $@"../../upload/" + tempname;
 return Json(rspJson);
 }
 public IActionResult About()
 {
 ViewData["Message"] = "Your application description page.";
 return View();
 }
 public IActionResult Contact()
 {
 ViewData["Message"] = "Your contact page.";
 return View();
 }
 public IActionResult Error()
 {
 return View();
 }
 }
 public class PicUploadResponse
 {
 public int error { get; set; }
 public string url { get; set; }
 }
}

配置kindeditor參數(shù)

<script type="text/javascript">
 //實(shí)例化編輯器
 //建議使用工廠方法getEditor創(chuàng)建和引用編輯器實(shí)例,如果在某個(gè)閉包下引用該編輯器,直接調(diào)用UE.getEditor('editor')就能拿到相關(guān)的實(shí)例
 KindEditor.ready(function (K) {
 window.editor = K.create('#detail_desc', {
 width: '98%',
 height: '500px',
 uploadJson: '/home/KindeditorPicUpload',
 fileManagerJson: '/home/KindeditorPicUpload',
 allowFileManager: true
 });
 }); 
</script>

運(yùn)行效果

源碼下載:http://xiazai.jb51.net/201611/yuanma/ASP.NETkindeditor(jb51.net).rar

聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

asp.net core集成kindeditor實(shí)現(xiàn)圖片上傳功能

本文為大家分享了asp.net core 如何集成kindeditor并實(shí)現(xiàn)圖片上傳功能的具體方法,供大家參考,具體內(nèi)容如下:準(zhǔn)備工作;1.visual studio 2015 update3開發(fā)環(huán)境。2.net core 1.0.1 及以上版本。目錄;新建asp.net core web項(xiàng)目。下載kindeditor。增加圖片上傳控制器;配置kindeditor參數(shù)。代碼下載;新建asp.net core web項(xiàng)目。新建一個(gè)asp.net core項(xiàng)目,這里命名為kindeditor。選中web應(yīng)用程序;下載kindeditor。這里我們新建了一個(gè)系統(tǒng)自帶的樣本項(xiàng)目,去 kindeditor官網(wǎng)下載一個(gè)版本,解壓后拷貝大wwwroot中。修改views/index.cshtml。
推薦度:
標(biāo)簽: 上傳圖片 圖片上傳 net
  • 熱門焦點(diǎn)

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 怀集县| 陆丰市| 尼玛县| 沙洋县| 丹阳市| 千阳县| 肃宁县| 腾冲县| 克山县| 丰顺县| 大埔县| 岳西县| 建始县| 探索| 五莲县| 桓台县| 内黄县| 南康市| 嘉善县| 涞水县| 哈密市| 泰和县| 葫芦岛市| 西城区| 武功县| 闽侯县| 文水县| 牟定县| 华容县| 闸北区| 祁连县| 万宁市| 姜堰市| 佛冈县| 铁岭县| 贡觉县| 邯郸县| 芦山县| 颍上县| 武汉市| 壶关县|