refactoring the file::is method.
This commit is contained in:
parent
f7e6b957de
commit
ba1d2a6238
|
@ -157,10 +157,14 @@ public static function is($extensions, $path)
|
|||
{
|
||||
$mimes = Config::get('mimes');
|
||||
|
||||
$mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
|
||||
|
||||
// The MIME configuration file contains an array of file extensions and
|
||||
// their associated MIME types. We will spin through each extension the
|
||||
// developer wants to check to determine if the file's MIME type is in
|
||||
// the list of MIMEs we have for that extension.
|
||||
foreach ((array) $extensions as $extension)
|
||||
{
|
||||
$mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
|
||||
|
||||
if (isset($mimes[$extension]) and in_array($mime, (array) $mimes[$extension]))
|
||||
{
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue