日期:2014-05-17  浏览次数:20534 次

关于KindEditor上传图片,用过KindEditor的来,求指点
到网上找了很多例子,都实现不了,我这里实现KindEditor的代码:
<script type="text/javascript">
  var editor;
  KindEditor.ready(function (K) {
  editor = K.create('textarea', {
  resizeType: 0,
  allowImageUpload: true,
  imageUploadJson: '../../asp.net/upload_json.ashx',
  fileManagerJson: '../../asp.net/file_manager_json.ashx',

  items: ['source', '|', 'fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste',
'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
'superscript', '|', 'selectall', '-',
'title', 'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold',
'italic', 'underline', 'strikethrough', 'removeformat', '|', 'image',
'flash', 'media', 'advtable', 'hr', 'emoticons', 'link', 'unlink', '|', 'about']
  });
  });

  function getValues() {

  var html = editor.html();

  editor.sync();
  html = document.getElementById('textarea').value;
  alert(html);
  }

  </script>
这样子已经能用了,功能也有了,但上传图片和视频都是报js错误,没有权限,我要怎样指定上传的地址?麻烦用过的人详细解说下,谢谢,我用的是asp.net

------解决方案--------------------
我的都没问题,还有KindEditor文件夹里面的upload_json.ashx和file_manager_json.ashx你自己要适当的修改。如果你网站发布到了服务器,要给kindeditor上传的文件夹添加everyone的用户权限。
 var editor1;
KindEditor.ready(function(K) {
editor1 = K.create('#txtContent', {
cssPath : '../KindEditor/plugins/code/prettify.css',
uploadJson : '../KindEditor/upload_json.ashx',
fileManagerJson : '../KindEditor/file_manager_json.ashx',
allowFileManager : true,
afterCreate : function() {
var self = this;
K.ctrl(document, 13, function() {
self.sync();
K('form[name=form1]')[0].submit();
});
K.ctrl(self.edit.doc, 13, function() {
self.sync();
K('form[name=form1]')[0].submit();
});
}
});
prettyPrint();
});

function check(){
editor1.sync();//将编辑器的HTML数据同步到textarea
if(editor1.isEmpty()){
document.getElementById("txtContent").value="";
}
if(Page_ClientValidate()){
return true;
}
return false;
}
------解决方案--------------------
你看他提供的范例,你能成功运行么?没问题,再移植到你项目工程。

注意引用的那些文件的路径。
------解决方案--------------------
关于Asp.Net Mvc3.0 使用KindEditor4.0 上传图片与文件