title: Invalid mode: wb when trying to upload file using Django and AJAX
body: <p>So I'm trying to use an <a href="http://kuhlit.blogspot.com/2011/04/ajax-file-uploads-and-csrf-in-django-13.html" rel="nofollow">ajax file upload form</a> with Django and running into an issue with FileIO. Specifically,</p>
  
  <pre><code>with BufferedWriter( FileIO( filename, "wb" ) ) as dest:
  </code></pre>
  
  <p>results in</p>
  
  <blockquote>
    <p>ValueError: invalid mode: wb</p>
  </blockquote>
  
  <p>I'm running Python 2.6/Django 1.3 locally on OSX 10.6.7. I tried chmod +X to the directory I'm targeting with the filename. Any idea what I'm missing? Thanks.</p>