javascript - How to add a csrf token to a post request in a image upload in CKEDITOR plugin? -


i using enhanced image plugin upload image server.my backend django.by taking django-ckeditor have implemented frontend , backend part of image upload in ckeditor.

however django-ckeditor not handle csrf protection in image upload. uses csrf_exempt decorator exempt csrf protection.

upload = csrf_exempt(imageuploadview.as_view()) 

how add csrf token post request made image upload?will have write own form in upload plugin handles csrf token?

the easy way add csrf token in filebrowserimageuploadurl, see below (jsp)

$(document).ready(function() {    var editor = ckeditor.replace('content', { skin: 'moonocolor',       toolbar: 'mytoolbar',        filebrowserimageuploadurl: "<c:url value="/site/upload"/>${_csrf.parametername}=${_csrf.token}" });    } }); 

Comments