title: Invalid form when uploading a file
body: <p>I am trying a basic example in uploading a file with django.
  I tried the code from the <a href="https://docs.djangoproject.com/en/1.10/topics/http/file-uploads/" rel="nofollow">django documentaion</a> but I keep getting invalid form. And when I don't test the validation of the form and try to handle the file directly, I get:</p>
  
  <blockquote>
    <p>MultiValueDictKeyError at /neurons/nblast
    "<br>
    'file'"</p>
  </blockquote>
  
  <p>P.S:
  Previously, I had used a model with a FileField and set the (upload_to), but in my current case I don't need to use the model, I only need to let the user uploads his files.</p>
  
  <p>This is my code:</p>
  
  <h2>Template</h2>
  
  <pre><code>&lt;body&gt;    
  &lt;form action="" method="post"&gt;
  
      {{ form }}
      &lt;br&gt;
      &lt;button class="btn btn-success" name="btn_upload"&gt;
          &lt;span class="glyphicon glyphicon-upload"&gt;&lt;/span&gt;
          &lt;b&gt;Upload&lt;/b&gt;
      &lt;/button&gt;
  
      {% csrf_token %}
  &lt;/form&gt;      
  &lt;/body&gt;
  </code></pre>
  
  <h2>Views</h2>
  
  <pre><code>def test(request):
      if request.method == GET:
          form = UploadFileForm()
  
      if request.method == POST:
          if 'btn_upload' in request.POST:                
              form = UploadFileForm(request.POST, request.FILES)                
              if form.is_valid():                   
                  handle_uploaded_file(request.FILES['file'])
              else:
                  print 'Not Valid'
  
          form = UploadFileForm()
  
      return render_to_response('test.html',
                                {'form': form},
                                context_instance=RequestContext(request))
  </code></pre>
  
  <h2>Forms:</h2>
  
  <pre><code>class UploadFileForm(forms.Form):
      file = forms.FileField()
  </code></pre>
  
  <p>Thank you very much</p>