title: In Django, how can one access file fields in forms.py?
body: <p>I have this form class in forms.py in my Django application:</p>
  
  <pre><code>class EmailForm(EmailFormWithoutAttachment):
      attachment = forms.FileField()
  </code></pre>
  
  <p>I would like to access the file uploaded in forms.py for validation via a clean function to validate its name.</p>
  
  <pre><code>def clean_attachment(self):
      if self.data['attachment'].name == "someFileName.txt":
          raise forms.ValidationError('This file is not allowed.')
      return self.data['attachment']
  </code></pre>
  
  <p>However, the problem is that an error notes that "attachment" is not found in "QueryDict." I am binding request.FILES to the submission form. I am also using enctype="multipart/form-data" on my forms. I was wondering what is the proper way to access FileField data in forms.py.</p>
  
  <p>Thank you.</p>