ajax file upload with a custom function

ajax file upload with a custom function

hhanh00hhanh00 Posts: 1Questions: 0Answers: 0

The document states that:

As of Editor 1.9 the ajax option can be used as a function allowing complete control over how the data is handled and sent to the server. This also allows fully client-side control of the data - e.g. processing an image in Javascript and submitting to the server as part of the actual form.

But it doesn't seem to work. Does someone has an example of it?

In the code, I don't see a test for "function", ajax is checked against string and ajax.data is checked against function, then $.extend({}, ajax, {...}) is called.
So ajax string and setup object is supported.

Replies

  • allanallan Posts: 64,008Questions: 1Answers: 10,554 Site admin

    Yes - line 81 in this example shows the Ajax override for that property.

    In the Editor code, the test is near the top of the upload function you are looking at:

        if ( typeof conf.ajax === 'function' ) {
            conf.ajax( files, function (ids) {
                completeCallback.call( editor, ids );
            } );
            return;
        }
    

    Allan

This discussion has been closed.