1. 程式人生 > >ueditor自定義上傳附件方法

ueditor自定義上傳附件方法

var root_url = window.location.protocol+"//"+window.location.host+window.location.pathname;

UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
UE.Editor.prototype.getActionUrl = function(action) {
   if (action == 'uploadfile') {
      return root_url+'?/attach_upload/id-files';
   } else {
      return this._bkGetActionUrl.call(this, action);
   }
}

覆蓋ueditor原生的上傳方法,改為自己的後臺方法,但要注意返回值格式要與ueditor要求的一致