Laravel mime类型的猜测者可供选择

My validation rules,

// Get request input
$caption = Request::input('caption');
$photo = Request::file('photo');

// Request validation
$validator = Validator::make(
        [
            'caption' => $caption,
            'photo' => $photo
        ],
        [
            'caption' => 'required',
            'photo' => 'mimes:jpeg,jpg'
        ]
    );

// If validation fails
if($validator->fails()) {
    return redirect()->back()->withInput()->withErrors($validator);
}

Error!

LogicException in MimeTypeGuesser.php line 127: Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)

I know the solution is to enable extension=php_fileinfo.dll in the php.ini settings.

But I am on a shared hosting and I have already talked to the server administrator to enable the extension. Unfortunately, they rejected my request showing some of the security reason.

Is their any alternative so I can validate my images?

There is no way to get mime type without php_fileinfo.dll SAFELY, (mime_content_type - deprecated)

You can get it from file extension (using somthing like https://github.com/yiisoft/yii/blob/master/framework/utils/mimeTypes.php) and create your own validation rule. but its not safe.

Sad, but really helpfull advice will be to change a hoster.