this is my custom dialog code:
CKEDITOR.dialog.add('myDialog', function(editor) {
return {
title : 'Insert File',
minWidth : 400,
minHeight : 200,
contents : [ {
id : 'Upload',
hidden : true,
filebrowser : 'uploadButton',
label : editor.lang.image.upload,
elements : [ {
type : 'file',
id : 'upload',
label : editor.lang.image.btnUpload,
style : 'height:40px',
size : 38
}, {
type : 'fileButton',
id : 'uploadButton',
filebrowser : 'info:txtUrl',
label : editor.lang.image.btnUpload,
'for' : [ 'Upload', 'upload' ]
} ]
} ],
};
});
And this is my php code:
<?php
require_once 'bootstrap.php';
require_once 'ckeditor/ckeditor.php';
$msg = '';
$callback = ($_GET ['CKEditorFuncNum']);
$image_url='http://www.google.com';
$output = '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(' . $callback . ', "' . $image_url . '","' . $msg . '");</script>';
die ( $output );
?>
Every thing work fine but i don't know how can get Url after upload in javascript side. For example I want to alert $url(http://www.google.com) after finish php side in javascript side.
Finally I found the solution. In the server-side I use this code and call parent function:
$output = "<script type='text/javascript'>window.parent.uploadMe('$image_url');</script>";
And in the client-side I use this code:
function uploadMe(url)
{
alert(url);
}