Send custom headers

This example shows how to use events to send a CSFR token with upload request.

Code

<!-- element -->
<textarea id="entry">...</textarea>

<!-- call -->
<script>
let app = Redactor('#entry', {
    image: {
        upload: '/image-uploader-path/'
    },
    subscribe: {
        'upload.before.send': function(event) {
            let xhr = event.get('xhr');
            xhr.setRequestHeader('X-CSRF-Token', 'your-token-value');
        }
    }
});
</script>