G
G
Ganki2019-02-02 15:49:40
Python
Ganki, 2019-02-02 15:49:40

What validator is needed to check type and size in MultipleFileField?

I'm making a form to upload multiple images at once.
I don't know which validator to check if the selected files are images,
and also if they are larger than a certain size.

from flask_wtf import FlaskForm
from wtforms import SubmitField, MultipleFileField
from wtforms.validators import Required


class UploadImagesForm(FlaskForm):
    images = MultipleFileField('Upload images', validators=[Required()])
    submit = SubmitField('Upload')

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alternativshik, 2019-02-02
@alternativshik

own validator.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question