Example #1
0
 /**
  * Validate the MIME type of a file upload attribute is in a set of MIME types.
  *
  * @param  string  $attribute
  * @param  array   $parameters
  * @return bool
  */
 protected function validate_mimes($attribute, $parameters)
 {
     foreach ($parameters as $extension) {
         if (File::is($extension, $this->attributes[$attribute]['tmp_name'])) {
             return true;
         }
     }
     return false;
 }
Example #2
0
 /**
  * Check if a file is one of the valid image types.
  * If so, return which one it is.  If not, return null.
  *
  * @param  string  $file
  * @return mixed
  */
 private static function image_type($file)
 {
     foreach (array('jpg', 'png', 'gif') as $type) {
         if (File::is($type, $file)) {
             return $type;
         }
     }
     return null;
 }