我有一个上传器,没有规则工作正常,但当我创建一个规则,我得到错误:
LogicException in MimeTypeGuesser.php line 127:
Unable to guess the mime type as no guessers are available
(Did you enable the php_fileinfo extension?)
Run Code Online (Sandbox Code Playgroud)
我的文章请求规则
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'Image' => 'required|mimes:jpeg'
];
}
Run Code Online (Sandbox Code Playgroud)
我的表格
{!! Form::open(['url' => 'blog', 'files'=> true]) !!}
<div class="form-group">
{!! Form::label('Image', 'Upload:') !!}
{!! Form::file('Image', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::submit('Submit', ['class' => 'btn btn-primary form-control']) !!}
</div>
{!! Form::close() !!}
Run Code Online (Sandbox Code Playgroud)
Sul*_*een 45
您应该在php.ini中启用以下行,然后重新启动您的Apache
extension=php_fileinfo.dll
Run Code Online (Sandbox Code Playgroud)
启用mean只是取消注释php.ini文件中的行
即,从此;extension=php_fileinfo.dll到extension=php_fileinfo.dll