This example shows how to use events to send a CSFR token with upload request.
<!DOCTYPE html>
<html>
<head>
<title>Redactor X</title>
<meta charset="utf-8">
<!-- css -->
<link rel="stylesheet" href="/your-dist-path/redactorx.min.css" />
</head>
<body>
<!-- element -->
<textarea id="entry">
<p>Content</p>
</textarea>
<!-- js -->
<script src="/your-dist-path/redactorx.min.js"></script>
<!-- call -->
<script>
RedactorX('#entry', {
image: {
upload: '/image-uploader-path/'
},
subscribe: {
'upload.before.send': function(event) {
var xhr = event.get('xhr');
xhr.setRequestHeader('X-CSRF-Token', 'your-token-value');
}
}
});
</script>
</body>
</html>