title: File upload with Django: Invalid form
body: <p>First time posting a question. I've basically copied everything I've found on here and on the django documentation site and I can't figure out what I'm doing incorrectly</p>
  
  <p>Here is the code from my views.py file</p>
  
  <pre><code>from django import forms
  
  class UploadFileForm(forms.Form):
      title = forms.CharField(max_length=50)
      file  = forms.FileField()
  
  def upload_file(request):   
      form = UploadFileForm(request.POST, request.FILES)
      if form.is_valid():
          response = "Form is valid."              
      else:
          response = "Failed to upload attachment."
      return HttpResponse(response)
  </code></pre>
  
  <p>And my html file: </p>
  
  <pre><code> &lt;form name="attachmentForm" action="http://mysite.com/uploadattachments" enctype="multipart/form-data" method="post"&gt;
        &lt;p&gt;
      Please specify a file, or a set of files:&lt;br/&gt;
      &lt;input id="attachment" type="file" name="datafile" size="40"/&gt;
        &lt;/p&gt;
        &lt;input type="submit" value="Send"/&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>When I test it out I get "Failed to upload attachment". Is there anything obvious that I'm missing here? I'm a bit new to django as well so I apologize if it's just a dumb error.
  Thanks in advance!</p>