protected function validateMimes($attribute, $value, $parameters)
{
if (!in_array($value, $_FILES, true)) {
return false;
}
if (!empty($value['tmp_name']) && is_uploaded_file($value['tmp_name']) && $value['error']) {
return false;
}
// The Symfony File class should do a decent job of guessing the extension
// based on the true MIME type so we'll just loop through the array of
// extensions and compare it to the guessed extension of the files.
if ($value['tmp_name'] !== '') {
return in_array(pathinfo($value['name'], PATHINFO_EXTENSION), $parameters, true);
} else {
return false;
}
}