I'm using kendo upload with Rails, and I had to hack the kendo.upload.js source code to get a feature that didn't seem to be apparent.
Basically, we need to submit a custom anti-CSRF token with every POST.
In kendo.upload, there is the method:
However, in Rails, this token is called authenticity_token. It seems like we have to do something like this:
Can we get authenticity_token added by default in the future? :)
Basically, we need to submit a custom anti-CSRF token with every POST.
In kendo.upload, there is the method:
function
getAntiForgeryTokens() {
var
tokens = { };
$(
"input[name^='__RequestVerificationToken']"
).each(
function
() {
tokens[
this
.name] =
this
.value;
});
return
tokens;
}
However, in Rails, this token is called authenticity_token. It seems like we have to do something like this:
$(thing).kendoUpload({
// ...
upload:
function
(event) {
event.data = {
authenticity_token: $(
"input[name=authenticity_token]"
).val()
};
}
});
Can we get authenticity_token added by default in the future? :)