tineMCE 踩坑:images_upload_handler
2024-09-07 18:19:50
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);
}
标红的部分就是修改的部分。
最新文章
- [LeetCode] Second Highest Salary 第二高薪水
- BestCoder Round 70
- ASP.NET Identity 简介
- rhel5.8安装oracle 10g ASM
- ArcGis 中MapControl 框选
- The web application [/codeMarket] registered the JBDC driver[.........] but failed to unregister it when the web application was stopped. To prevent
- Deployed component GUIs and figures have different look and feel than MATLAB desktop
- vc静态加载dll和动态加载dll
- Java类加载机制深度分析
- VC++编程之字符串解惑--Unicode &; MBCS
- Study notes for Latent Dirichlet Allocation
- 读了前半本<;Thinking in Java>;
- [转]安卓新一代多渠道打包工具Walle 解决渠道包V2签名问题
- 解决 React-Native mac 运行报错 error Failed to build iOS project. We ran ";xcodebuild"; command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by ope
- elementUi中的计数器ele-mumber中的change事件传参及事件调用
- numpy知识点
- 轮播图js编写
- Android学习笔记----Java字符串MD5加密
- python 入门基础21 --面向对象_多态、内置方法、反射
- C# 远程服务器 安装、卸载 Windows 服务,读取远程注册表,关闭杀掉远程进程
热门文章
- 安装mysql报错:遇到缺少vcruntime140_1.dll文件
- Java中的I/O流全汇总,所有的I/O就一张图
- Elasticsearch、Solr、Lucene、Hermes区别
- set dict tuple 内置方法
- DNS注册信息
- 【弹性碰撞问题】POJ 1852 Ants
- 【写法总结】$.ajax与$.post、$.get 写法区别
- ASP.NET MVC 四种Controller向View传值方法
- 浅谈auth模块
- vim中设置tab的长度