public/minimumui/js/image_upload.js
/**
     * Upload the image to the server
     * and redirect ot the callback url specified in the constructor
     */
Upload the image to the server
and redirect ot the callback url specified in the constructor
Upload the image to the server and redirect ot the callback url specified in the constructor
upload() {
        var params = $('#submitForm').serialize();
        var image_upload = this;
        var xmlHttp = new XMLHttpRequest();
        xmlHttp.open('POST', '/repository/file/upload?encoding=base64&_token=' + this.apiKey + '&' + params);
        xmlHttp.setRequestHeader('Content-Type', 'application/json');
        xmlHttp.onreadystatechange = () => {
            if (xmlHttp.readyState === XMLHttpRequest.DONE) {
                var response = JSON.parse(xmlHttp.responseText);
                if (response.http_code < 400) {
                    image_upload.uploadFinished(response.url);
                }
                if (response.http_code >= 400) {
                    image_upload.validationFailure(response.fields, response.status);
                }
            }
        };
        xmlHttp.send(this.getRawImage());
    }
upload ( ) { var params = $ ( '#submitForm' ) . serialize ( ) ; var image_upload = this ; var xmlHttp = new XMLHttpRequest ( ) ; xmlHttp . open ( 'POST' , '/repository/file/upload?encoding=base64&_token=' + this . apiKey + '&' + params ) ; xmlHttp . setRequestHeader ( 'Content-Type' , 'application/json' ) ; xmlHttp . onreadystatechange = ( ) => { if ( xmlHttp . readyState === XMLHttpRequest . DONE ) { var response = JSON . parse ( xmlHttp . responseText ) ; if ( response . http_code < 400 ) { image_upload . uploadFinished ( response . url ) ; } if ( response . http_code >= 400 ) { image_upload . validationFailure ( response . fields , response . status ) ; } } } ; xmlHttp . send ( this . getRawImage ( ) ) ; }
Upload the image to the server
 and redirect ot the callback url specified in the constructor
Upload the image to the server and redirect ot the callback url specified in the constructor