From 33c6027476398a8623d8382fdab838fbb0425ac2 Mon Sep 17 00:00:00 2001 From: Koen Schmeets Date: Thu, 26 Apr 2012 21:24:06 +0200 Subject: [PATCH] Adding has_file method Signed-off-by: Koen Schmeets --- laravel/input.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/laravel/input.php b/laravel/input.php index a44bd85b..802b4008 100644 --- a/laravel/input.php +++ b/laravel/input.php @@ -178,6 +178,18 @@ public static function file($key = null, $default = null) return array_get($_FILES, $key, $default); } + /** + * Determine if the uploaded data contains a file. + * + * @param string $key + * @return bool + */ + public static function has_file($key) + { + $file = static::file($key); + return ! empty($file['tmp_name']); + } + /** * Move an uploaded file to permanent storage. *