php – Laravel 5 – 验证Mime类型
发布时间:2020-12-14 19:50:24 所属栏目:大数据 来源:网络整理
导读:我有一个上传者没有规则的工作正常, 但是当我创建一个规则我得到错误: LogicException in MimeTypeGuesser.php line 127:Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?) 我的文章请求规则 /**
我有一个上传者没有规则的工作正常,
但是当我创建一个规则我得到错误: LogicException in MimeTypeGuesser.php line 127: Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?) 我的文章请求规则 /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'Image' => 'required|mimes:jpeg' ]; } 我的形式 {!! 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() !!}
您应该在php.ini中启用以下行,然后重新启动您的apache
extension=php_fileinfo.dll 启用意味着只需取消注释php.ini文件中的行 即From this; extension = php_fileinfo.dll到extension = php_fileinfo.dll (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |