title: What am I not doing right in this django file upload form?
body: <p>This is my form:</p>
  
  <pre><code>from django import forms
  
  class UploadFileForm(forms.Form):
      titl    = forms.CharField(max_length=50)
      ffile   = forms.FileField()
  </code></pre>
  
  <p>This is my views.py file:</p>
  
  <pre><code>def handle_uploaded_file(file_path):
      print "handle_uploaded_file"
      dest = open(file_path.name,"wb")
      for chunk in file_path.chunks():
          dest.write(chunk)
      dest.close()
  
  def handle_upload(request):
      c = {}
      c.update(csrf(request))
      if request.method == "POST":
          form = UploadFileForm(request.POST)
          if form.is_valid():
              handle_uploaded_file(request.FILES["ffile"])
              return HttpResponseRedirect("/thanks")
      else:
          form = UploadFileForm()
      c.update({"form":form})
      return render_to_response("upload.html",c)
  </code></pre>
  
  <p>And this is the content of upload.html:</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" method="post" action="/handle_upload/"&gt;
      {% csrf_token %}
      {{ form.as_p }}
      &lt;input type="submit" value="Upload it"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Whenever I try to submit the form, I get a "This field is required" for the <code>ffile</code> field. What am I doing wrong? Just to mention, I am uploading a file each time.</p>