title: AttributeError: 'NoneType' object has no attribute 'filename' for Flask Uploads
body: <p>I'm using <strong>Flask 1.0.2</strong> and <strong>Flask-WTF 0.14.2</strong> but I don't understand why filename is empty.</p>
  
  <p>First I create a forms.py like this</p>
  
  <pre><code>images = UploadSet('images', IMAGES)
  docs = UploadSet('docs', ['pdf', 'doc', 'docx', 'PDF', 'DOC', 'DOCX', 'jpg', 'jpeg', 'png', 'JPG', 'PNG', 'JPEG'])
  configure_uploads(app, (images, docs))
  class EvenementForm(FlaskForm):
      titre = StringField(u'titre', validators=[DataRequired()])
      periode = StringField(u'periode', validators=[DataRequired()])
      description = TextAreaField(u'description', validators=[DataRequired()])
      lieu = StringField(u'lieu', validators=[DataRequired()])
      image = FileField(u'image', validators=[FileAllowed(docs, u'Documents seulement. Le poids ne doit pas d&amp;eacute;passer les 300 Ko!')])
  
      def __init__(self, *args, **kwargs):
          super(EvenementForm, self).__init__(*args, **kwargs) 
  </code></pre>
  
  <p>Then my views.py look like this</p>
  
  <pre><code>@admin.route('/events', methods=['GET', 'POST'])
  def events():
       form = EvenementForm()
       if request.method == 'POST' and form.validate_on_submit():
            evenement = Evenements(titre=form.titre.data, lieu=form.lieu.data, periode=form.periode.data, description=form.description.data)
  
            otherfile = form.image.data.filename
  
            if otherfile:
                 otherfile = secure_filename(otherfile)
                 date = "{:%I%M%S%f%d%m%Y}".format(datetime.now())
                 otherfile = date + otherfile
                 form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], 'resumes/'+otherfile))
                 evenement.image = otherfile
            db.session.add(evenement)
            db.session.commit()
            flash('Thanks for adding')
            return redirect(url_for('admin.events'))
       return render_template("admin/events.html", form=form)
  </code></pre>
  
  <p>and my template look like this :</p>
  
  <pre><code>&lt;form action="" method="POST" enctype="multipart/form-data"&gt;
      &lt;div class="col-lg-12"&gt;
          {{ form.csrf_token }}
          &lt;input type="hidden" class="form-control" name="event_id" value="0" autocomplete="off"&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="speaker_name"&gt;Titre :&lt;/label&gt;
              {{ form.titre(placeholder='Entrez le titre de l\'évenement', class='form-control', required='required') }}
              &lt;span style="color:red"&gt;{% if form.titre.errors %}{{ form.titre.errors[0] }}{% endif %}&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="speaker_job"&gt;Lieu:&lt;/label&gt;
              {{ form.lieu(placeholder='Entrez le lieu de l\'évenement', class='form-control', required='required') }}
              &lt;span style="color:red"&gt;{% if form.lieu.errors %}{{ form.lieu.errors[0] }}{% endif %}&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="speaker_job"&gt;Lieu:&lt;/label&gt;
              {{ form.periode(placeholder='Entrez la periode de l\'évenement', class='form-control', required='required') }}
              &lt;span style="color:red"&gt;{% if form.periode.errors %}{{ form.periode.errors[0] }}{% endif %}&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="speaker_job"&gt;Lieu:&lt;/label&gt;
              {{ form.description(placeholder='Entrez la description de l\'évenement', class='textarea textarea-style', required='required') }}
              &lt;span style="color:red"&gt;{% if form.description.errors %}{{ form.description.errors[0] }}{% endif %}&lt;/span&gt;     
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="speaker_picture"&gt;Image&lt;/label&gt;
              {{ form.image(placeholder='Entrez l\'image de l\'évenement', class='form-control', required='required') }}
              &lt;span style="color:red"&gt;{% if form.image.errors %}{{ form.image.errors[0] }}{% endif %}&lt;/span&gt;
          &lt;/div&gt; 
          &lt;button type="button"  class="btn btn-bold btn-pure btn-danger" data-dismiss="modal"&gt;
              Annuler
          &lt;/button&gt;
          &lt;button type="submit" class="btn btn-bold btn-pure btn-info float-right"&gt;
              Enregistrer
          &lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And I'm facing this error</p>
  
  <blockquote>
    <p>AttributeError: 'NoneType' object has no attribute 'filename'</p>
  </blockquote>
  
  <p>how could I solve it ?</p>