views:

22

answers:

1

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?

+1  A: 

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.

Daniel Roseman