A
A
Adel1ne2016-01-19 07:45:32
Yii
Adel1ne, 2016-01-19 07:45:32

Uploading files in yii2 debug?

Hello!
Faced such a problem, I upload a picture using UploadForm (the standard algorithm for uploading files in yii2). Everything would be fine, but one picture stubbornly refuses to load, moreover, if you remove the line from the rules :'extensions' => 'jpg, png'

public function rules()
    {
        return [
            [['imageFile'], 'file', 'skipOnEmpty' => false, 'extensions' => 'jpg, png'],
        ];
    }

the picture is loading. It turns out that the validator considers that the uploaded file is not jpg, although it is very jpg for my modest taste. Tell me how to track this error, what exactly does the validator not like?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
M
Maxim Kolokolnikov, 2016-01-19
@maxmirazh33

Maybe it's not jpg, but jp e g?)

A
Alexander, 2016-01-19
@p0vidl0

And so?
'extensions' => ['jpg', 'png']

S
shamyyl, 2016-01-19
@shamyyl

You can debug in the class yii\validators\FileValidator

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question