Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 - image validation doesn't work

I am using Laravel 5 Validator for validating avatars, my rules look like this:

$validator = Validator::make(
    Request::all(),
    [
        'avatar' => 'required|image|max:1000'
    ]
);

I am trying to upload files and it always says "no file choosen". If I remove the required rule, then it works, even the max:1000 rule work.

like image 788
Tadeáš Jílek Avatar asked Jun 14 '15 16:06

Tadeáš Jílek


1 Answers

make sure that form accept files,

Form::open(array('url' => 'foo/bar', 'files' => true))

or

<form action="foo/bar" enctype="multipart/form-data">
like image 80
Kiran LM Avatar answered Nov 15 '22 11:11

Kiran LM