请输入关键字
asp.net中kindeditor4.1.7用法及配置图片上传,图片批量上传
Alin|2018-3-29

从官网下载kindeditor4.1.7:

1、将文件夹复制到VS2010

2、将文件 LitJSON.dll 复制到web\bin目录下,并添加引用

3、修改file_manager_json.ashx文件中的图片保存目录

 String rootUrl = aspxUrl + "Uploads/";

4、修改upload_json.ashx文件中的图片保存目录

//文件保存目录路径
        String savePath = "Uploads/";

  //文件保存目录URL
        String saveUrl = aspxUrl + "Uploads/";

 

5、修改kindeditor417\plugins\image\images.js文件(原文件为PHP的配置)

uploadJson = K.undef(self.uploadJson, self.basePath + 'asp.net/upload_json.ashx'),

 

6、页面:

<%@ Page Title="" Language="C#" MasterPageFile="~/admin/MsRigth.Master" AutoEventWireup="true" ValidateRequest="false" CodeBehind="StudentPhotoAdd.aspx.cs" Inherits="WebSite.Web.admin.StudentPhotoAdd" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<meta charset="utf-8" />

 <link rel="stylesheet" href="kindeditor417/themes/default/default.css" />
 

    <link href="kindeditor417/plugins/code/prettify.css" rel="stylesheet" type="text/css" />

    <script charset="utf-8"  src="kindeditor417/plugins/code/prettify.js" type="text/javascript"></script>
    <script charset="utf-8" src="kindeditor417/lang/zh_CN.js" type="text/javascript"></script>
    <script charset="utf-8" src="kindeditor417/kindeditor.js" type="text/javascript"></script>
<script type="text/javascript">
    KindEditor.ready(function (K) {
        var editor1 = K.create('#editor', {


            cssPath: 'kindeditor417/plugins/code/prettify.css',
            uploadJson: 'upload_json.ashx',
            fileManagerJson: 'file_manager_json.ashx',
            allowFileManager: true,
            syncType: "auto",
            afterCreate: function () {
                var self = this;
                KindEditor.ctrl(document, 13, function () {
                    self.sync();
                    KindEditor('form[name=example]')[0].submit();
                });
                KindEditor.ctrl(self.edit.doc, 13, function () {
                    self.sync();
                    KindEditor('form[name=example]')[0].submit();
                });
            },
            afterChange: function () { this.sync(); },
            afterBlur: function () { editor1.sync(); }
        });
 
        prettyPrint();
    }); </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
添加学生照片
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
   
 <textarea id="editor" name="content" style="width:700px;height:300px;"></textarea>
 
</asp:Content>

 

 

注意:

整个配置过程中,需要注意upload_json.ashx、file_manager_json.ashx等文件的路径问题

OK

赞一下26||已浏览3833

本站版本归木之林解释所有 copyright(C)2010-2025www.mzlin.net 备案/许可证编号为:粤ICP备15050036号