From ba1d2a62380c1771699cd8e0546bca60c0ced483 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 18 Jan 2012 09:23:05 -0600 Subject: [PATCH] refactoring the file::is method. --- laravel/file.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/laravel/file.php b/laravel/file.php index ec2f1fa7..3e7143ea 100644 --- a/laravel/file.php +++ b/laravel/file.php @@ -157,10 +157,14 @@ class File { { $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;