Fix bug in validate_mimes method.
This commit is contained in:
parent
e89fd04ab7
commit
9f78c8be90
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue