So I am using jquery file upload in a rails 3 app, and everything works beautifully, well except in IE 9 that is. Only in IE9, when I try to upload a file, I keep getting the 'cant verify csrf token' error in my console. I installed Firebug lite to inspect it, and the correct csrf token is correct and is in the right place in the document (and yes I have my <%= csrf_meta_tags %> tag in the header of layout file). Not sure why it is only doing this in IE 9, has anyone seen this before?
I had the same issue and the comment above from the OP helped me find the answer. Here is what worked for me:
$('#fileupload').fileupload({
... other options
formData: [
{ name: 'authenticity_token', value: $('meta[name="csrf-token"]').attr('content') }
]
});
Note that the layout file (application.html.erb in Rails 3.2) should have the following:
<%= csrf_meta_tags %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With