Browse Source

fix the validation of required file uploads.

Taylor Otwell 13 years ago
parent
commit
472e377b02
1 changed files with 5 additions and 1 deletions
  1. 5 1
      laravel/validator.php

+ 5 - 1
laravel/validator.php

@@ -223,6 +223,10 @@ class Validator {
 		{
 			return false;
 		}
+		elseif ( ! is_null(Input::file($attribute)) and $value['tmp_name'] == '')
+		{
+			return false;
+		}
 
 		return true;
 	}
@@ -502,7 +506,7 @@ class Validator {
 	 */
 	protected function validate_mimes($attribute, $value, $parameters)
 	{
-		if (is_array($value) and ! isset($value['tmp_name'])) return true;
+		if ( ! is_array($value) or Arr::get($value, 'tmp_name', '') == '') return true;
 
 		foreach ($parameters as $extension)
 		{