From 472e377b02a580f81106b7a96f9e4cee3195a819 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 27 Nov 2011 15:38:59 -0600 Subject: [PATCH] fix the validation of required file uploads. --- laravel/validator.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/laravel/validator.php b/laravel/validator.php index 1c72e184..c815f503 100644 --- a/laravel/validator.php +++ b/laravel/validator.php @@ -223,6 +223,10 @@ protected function validate_required($attribute, $value) { return false; } + elseif ( ! is_null(Input::file($attribute)) and $value['tmp_name'] == '') + { + return false; + } return true; } @@ -502,7 +506,7 @@ protected function validate_alpha_dash($attribute, $value) */ 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) {