Halp, halp, halp.
Hello guys. I'm writing a plugin for a simple image upload. I wanna post a hidden CSRF-Token with the uploaded image file. I tried a few things, but without success. Can you please help me?
This is my code so far:
Hello guys. I'm writing a plugin for a simple image upload. I wanna post a hidden CSRF-Token with the uploaded image file. I tried a few things, but without success. Can you please help me?
This is my code so far:
CKEDITOR.plugins.add('ImageUpload',
{
init: function(editor)
{
var pluginName = 'ImageUpload';
var me = this;
CKEDITOR.dialog.add('ImageUploadDialog', function(editor) {
return {
title : 'Upload Image...',
minWidth : 350,
minHeight : 70,
buttons: '',
contents : [
{
id : 'Upload',
hidden : true,
filebrowser : 'uploadButton',
label : editor.lang.image.upload,
elements :
[
{
type:'text',
id:'CSRF-Token',
label:'CSRF-Token',
hidden:true,
},
{
type : 'file',
id : 'upload',
label : editor.lang.image.btnUpload,
style: 'height:40px',
size : 30,
},
{
type : 'fileButton',
id : 'uploadButton',
filebrowser : 'info:txtUrl',
label : editor.lang.image.btnUpload,
'for' : [ 'Upload', 'upload' ]
}
]
},
]
};
});
editor.addCommand(pluginName, new CKEDITOR.dialogCommand('ImageUploadDialog') );
// add button to the toolbar
editor.ui.addButton(pluginName,
{
label: 'upload Image',
command: pluginName,
icon: this.path + 'images/icon.png'
} );
}
}
);
