作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个在 TinyMCE 中工作的图像处理程序:
images_upload_handler: function (blobInfo, success, failure) {
var xhr, formData;
xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.open('POST', 'queries/editorImageUpload.php');
xhr.onload = function() {
var json;
if (xhr.status != 200) {
failure('HTTP Error: ' + xhr.status);
return;
}
console.log(xhr.response);
//your validation with the responce goes here
success(xhr.response);
};
formData = new FormData();
formData.append('file', blobInfo.blob(), blobInfo.filename());
xhr.send(formData);
}
我想将另一条数据发送到“editorImageUpload”页面,作为要将图像添加到的目录的名称。但我不确定如何添加它。我会把它添加到追加行吗?:
formData.append('file','directoryNameGoesHere', blobInfo.blob(), blobInfo.filename());
或者这会弄乱追加的结构。谢谢。
最佳答案
如果您想添加更多要发送的值,只需像处理 Blob 一样附加它们
formData = new FormData();
formData.append('file', blobInfo.blob(), blobInfo.filename());
formData.append('directory','path/to/whereever');
然后读取$_POST['directory']
获取值
关于javascript - 如何使用 TINYMCE images_upload_handler 发送其他 POST 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49499135/
有什么方法可以在 Tinymce 5 的 images_upload_handler 中验证图像文件的大小。 tinymce.init({ selector: '#mytextarea
默认情况下,tinymce 图像没有浏览按钮,您可以单击该按钮并看到一个对话框来选择图像。在我的代码中,我尝试将图像选择器按钮添加到tinymce,但发现很难将其与images_upload_hand
我有一个在 TinyMCE 中工作的图像处理程序: images_upload_handler: function (blobInfo, success, failure) {
我是一名优秀的程序员,十分优秀!