Fix bug in validate_mimes method.

This commit is contained in:
Taylor Otwell 2011-11-04 09:41:21 -05:00
parent e89fd04ab7
commit 9f78c8be90
1 changed files with 6 additions and 3 deletions

View File

@ -447,7 +447,7 @@ protected function validate_active_url($attribute, $value)
*/ */
protected function validate_image($attribute, $value) protected function validate_image($attribute, $value)
{ {
return $this->validate_mimes($attribute, array('jpg', 'png', 'gif', 'bmp')); return $this->validate_mimes($attribute, $value, array('jpg', 'png', 'gif', 'bmp'));
} }
/** /**
@ -490,14 +490,17 @@ protected function validate_alpha_dash($attribute, $value)
* Validate the MIME type of a file upload attribute is in a set of MIME types. * Validate the MIME type of a file upload attribute is in a set of MIME types.
* *
* @param string $attribute * @param string $attribute
* @param array $value
* @param array $parameters * @param array $parameters
* @return bool * @return bool
*/ */
protected function validate_mimes($attribute, $parameters) protected function validate_mimes($attribute, $value, $parameters)
{ {
if (is_array($value) and ! isset($value['tmp_name'])) return true;
foreach ($parameters as $extension) foreach ($parameters as $extension)
{ {
if (File::is($extension, $this->attributes[$attribute]['tmp_name'])) if (File::is($extension, $value['tmp_name']))
{ {
return true; return true;
} }