This example shows how to send custom headers while uploading an image or file.
<!--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>