title: Why does Django file upload throws a IOError (2, 'No such file or directory') exception?
body: <p>I'm writing a simple file uploader for a website. The user sees a form:</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" action="/uploader/" name="upload" method="post"&gt;
    &lt;input type="file" name="datafile" size="20"&gt;
    {% csrf_token %}
    &lt;span class="whats_this"&gt;Maximum File Size is 100 MB&lt;/span&gt;
    &lt;button class="button orange" type="start_upload" value="Submit" onclick="document.upload.submit() "&gt;Start Upload&lt;/button&gt;
    &lt;span class="cancel_button"&gt;&lt;a href="#"&gt;Cancel&lt;/a&gt;&lt;/span&gt;     
  &lt;/form&gt;
  </code></pre>
  
  <p>and upon submit, I redirect to this function:</p>
  
  <pre><code>def uploadFiles(request):
    if request.method == 'POST':    
       if(validate(request)):
          file = request.FILES['datafile']
  
          destination = open('uploadedFiles/test.txt', 'wb+')
  
          for chunk in file.chunks():
              destination.write(chunk)
          destination.close()
  
          context = {'files': file.name}
          return render_to_response('dashboard.html', context)
      else:
          ...
  </code></pre>
  
  <p>When I try this functionality out, I'll always get an exception:</p>
  
  <pre><code>IOError at /uploader/
  (2, 'No such file or directory')
  uploader\views.py in uploadFiles, line 17
  </code></pre>
  
  <p>Line 17 is the line of the destination "destination = open('uploadedFiles/test.txt', 'wb+')". I've been trying this out quite a bit but it simply doesn't work. Am I missing something important here?</p>