Umair Umair - 1 year ago 99
Javascript Question

Is there any callback function for Upload Image addon for CKEditor?

I am using CKeditor in my project and I have a requirement where I need to upload images too.

I have downloaded Addon and it works fine. It perfectly sends data to server too.

I just needed to add

CKEDITOR.config.filebrowserBrowseUrl = '/browser/browse.php';
CKEDITOR.config.filebrowserUploadUrl = '/uploader/upload.php';

to make it work.

But issue is, I want to to send additional parameters to server as well, so I know which product/item is being edited.

Sending just image to server makes no sense to me, CKEditor has no information on it. Can someone please help me to send additional parameter to

Answer Source

you can set CKEDITOR.config.filebrowserUploadUrl dynamically when you call CKEDITOR.replace(); this gives the ability to set different UploadUrl in different page.

In your case I think you just need append different query string to uploadUrl


    {filebrowserImageUploadUrl : '/uploader/upload.php?productId=123', 
    filebrowserBrowseUrl : '/uploader/upload.php'}

In serverside upload.php you can receive productId when upload process is done, pass the productId to a callback function;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download