. NET MVC uses Kindeditor to upload local images

Source: Internet
Author: User

Recently in the Kindeditor editor, when uploading local images encountered some problems, can not upload correctly.

Now make a note of the configuration of uploading local images using Kindeditor.

1, download kindeditor. http://kindeditor.net/down.php

2, unzip, copy all files to the project. I put it in the content.


(You can delete the following directory as required after uploading to the server, asp-asp program, asp.net-asp.) NET programs, php-php programs, jsp-jsp programs, examples-demo files)

3 . Copy the DLL files from the Editor/asp.net/bin directory to the project Bin directory.

4. Modify HTML page

a> add textarea input box

<td> @Html. textareafor (A = a.contents, new {id = "editor_id"}) </td><!--or <td><textarea id= "editor_id" name= "Contents" >Model.contents</textarea>-
b>Add the following script to the page
    <script charset= "Utf-8" src= "~/content/editor/kindeditor.js" ></script> <script charset= "Utf-8" src= " ~/content/editor/lang/zh_cn.js "></script> <script> kindeditor.ready (function (K) {win  Dow.editor = k.create (' #editor_id ', {width: ' 600px ', Height: ' 400px ', items:                        [' Source ', ' | ', ' undo ', ' Redo ', ' | ', ' preview ', ' print ', ' template ', ' cut ', ' copy ', ' Paste ', ' | ', ' Justifyleft ', ' justifycenter ', ' justifyright ', ' | ', ' insertorderedlist ', ' insertunorderedlist ', ' C                        Learhtml ', ' quickformat ', ' | ', ' anchor ', ' link ', ' unlink ', ' | ', ' fullscreen ', '/', ' Formatblock ', ' fontname ', ' fontsize ', ' | ', ' forecolor ', ' hilitecolor ', ' bold ', ' Italic ', ' u Nderline ', ' lineheight ', ' removeformat ', ' | ', ' image ', ' multiimage ', ' flash ', ' media ', ' insertfile '                  , '|',      ' Table ', ' hr ', ' emoticons ', ' baidumap '],//uploadjson: ' ~/content/editor/asp.net/upload_json.ashx ', In the online need to configure this sentence, but the comments are not error ...        Only the following filemanagerjson are required: ' ~/content/editor/asp.net/file_manager_json.ashx ',});    }); </script>

If you change the file location of editor, modify the save path of Upload_json.ashx and File_manager_json.ashx. Mine is the default.

Find the image folder under the Plugins folder, there is a image.js file, the default is PHP, to be modified to ASP.


When uploading a local image, the path displays c:\fakepath\***, showing that the Fakepath is normal and is unable to obtain a real path for security reasons.

The Last:


. NET MVC uses Kindeditor to upload local images

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.