Laravel 5-图像验证不起作用

问题描述:

我正在使用Laravel 5 Validator来验证头像,我的规则如下:

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

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

我正在尝试上传文件,并且总是显示未选择文件".如果我删除了必需的规则,那么它就可以了,甚至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.

确保该表单接受文件,

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

<form action="foo/bar" enctype="multipart/form-data">