I'm stuck at the moment trying to figure out how can I send the antiforgery token using Dropzone.js and vanilla javascript (no jQuery).
This is my initialization code at the moment:
$(document).ready(function (e) {
var myDropzone = new Dropzone("#myDropzone", { url: "/Media/AjaxUpload", maxFilesize: 10, addRemoveLinks: true, maxFiles: 1 });
myDropzone.on("success", function (response) {
//Do some personal stuff.
});
myDropzone.on("sending", function (xhr, formData) {
formData["__RequestAntiForgeryToken"] = document.getElementsByName("__RequestVerificationToken")[1].value
});
});
I have tried appending the token to no avail on Dropzone's sending event, even at the header. Any suggestions on how to achieve this?