title: Trying to validate Filefield using wtforms
body: <p>I am trying to capture the filename of an uploaded file via a wtforms FileField</p>
  
  <p>in my validator</p>
  
  <pre><code>    def checkfile(form,field):
              print form
              print field
  </code></pre>
  
  <p>the 'print forms' statement shows: forms.ticket.TicketForm object at 0x1d2a350</p>
  
  <p>the 'print fields' statement shows: input id="files" name="files" type="file"</p>
  
  <p>if i try to access field.file or field.files i get the error: 'FileField' object has no attribute 'file(s)'</p>
  
  <p>field.data is empty</p>
  
  <p>so how can i access the filename to run a validator?</p>
  
  <p>relevant portion of my class:</p>
  
  <pre><code>class MyForm(wtforms.Form):
       files = wtforms.FileField('Files',[checkfile])
  </code></pre>
  
  <p>which is rendered in my template as:</p>
  
  <pre><code>   &lt;form enctype="multipart/form-data" class="form-horizontal" name="add_ticket"      action="/ticket/add" method="post"&gt;
   &lt;input type="hidden" name="_xsrf" value="xxxxxxxxxx"/&gt;
   &lt;input class="input-medium" id="files" name="files" type="file"&gt;
   &lt;/form&gt;
  </code></pre>