开发者

Django ajax file upload problem csrf

开发者 https://www.devze.com 2023-01-19 11:45 出处:网络
I\'m trying to do a ajax file upload using django. I am trying to make this example work http://www.johnberns.com/2010/07/08/using-valums-jquery-ajax-upload-with-django-1-2/

I'm trying to do a ajax file upload using django. I am trying to make this example work

http://www.johnberns.com/2010/07/08/using-valums-jquery-ajax-upload-with-django-1-2/

开发者_开发技巧

But strangely I keep getting "None" for my csrf token and even more strange is that I am doing the POST call sending the file but all I get on the server is just the following dict:

{u'csrfmiddlewaretoken': [u'None']}

What am I doing wrong?


The whole premise of that linked article is wrong. You don't need to worry about the CSRF token - CSRF protection is automatically disabled for Ajax uploads, since there is no way of making it work reliably. See the documentation.

0

精彩评论

暂无评论...
验证码 换一张
取 消