Send custom headers while uploading

This example shows how to send custom headers while uploading an image or file.

Code

<!--element -->
<textarea id="content"></textarea>

<!-- call -->
<script>
$R('#content', {
    imageUpload: '/your-upload-script/',
    callbacks: {
        upload: {
            beforeSend: function(xhr)
            {
                xhr.setRequestHeader('X-CSRF-Token', 'your-token-value');
            }
        }
    }
});
</script>