tineMCE 的官方示例提供了前端上传图片方法 images_upload_handler 的写法。

但官方写的有点问题,上传会报错。

不过修改也很简单:

images_upload_handler: function (blobInfo, success, failure) {
var xhr, formData; xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.open('POST', 'http://localhost/oasis_publish_test_php/index.php/upload/upImg'); xhr.onload = function() {
var json; if (xhr.status < 200 || xhr.status >= 300) {
failure('HTTP Error: ' + xhr.status);
return;
} json = JSON.parse(xhr.responseText); if (!json || typeof json.location != 'string') {
failure('Invalid JSON: ' + xhr.responseText);
return;
} success(json.location);
}; formData = new FormData();
formData.append('file', blobInfo.blob()); xhr.send(formData);
}

标红的部分就是修改的部分。

最新文章

  1. [LeetCode] Second Highest Salary 第二高薪水
  2. BestCoder Round 70
  3. ASP.NET Identity 简介
  4. rhel5.8安装oracle 10g ASM
  5. ArcGis 中MapControl 框选
  6. The web application [/codeMarket] registered the JBDC driver[.........] but failed to unregister it when the web application was stopped. To prevent
  7. Deployed component GUIs and figures have different look and feel than MATLAB desktop
  8. vc静态加载dll和动态加载dll
  9. Java类加载机制深度分析
  10. VC++编程之字符串解惑--Unicode &amp; MBCS
  11. Study notes for Latent Dirichlet Allocation
  12. 读了前半本&lt;Thinking in Java&gt;
  13. [转]安卓新一代多渠道打包工具Walle 解决渠道包V2签名问题
  14. 解决 React-Native mac 运行报错 error Failed to build iOS project. We ran &quot;xcodebuild&quot; command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by ope
  15. elementUi中的计数器ele-mumber中的change事件传参及事件调用
  16. numpy知识点
  17. 轮播图js编写
  18. Android学习笔记----Java字符串MD5加密
  19. python 入门基础21 --面向对象_多态、内置方法、反射
  20. C# 远程服务器 安装、卸载 Windows 服务,读取远程注册表,关闭杀掉远程进程

热门文章

  1. 安装mysql报错:遇到缺少vcruntime140_1.dll文件
  2. Java中的I/O流全汇总,所有的I/O就一张图
  3. Elasticsearch、Solr、Lucene、Hermes区别
  4. set dict tuple 内置方法
  5. DNS注册信息
  6. 【弹性碰撞问题】POJ 1852 Ants
  7. 【写法总结】$.ajax与$.post、$.get 写法区别
  8. ASP.NET MVC 四种Controller向View传值方法
  9. 浅谈auth模块
  10. vim中设置tab的长度