From c51575feab25410767f61539422580dd5f17fe1a Mon Sep 17 00:00:00 2001 From: otengkwame Date: Wed, 27 Apr 2022 21:43:44 +0000 Subject: [PATCH] :sparkles: add files method Signed-off-by: otengkwame --- framework/core/Input.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/framework/core/Input.php b/framework/core/Input.php index b6d4b57..38d7c7d 100644 --- a/framework/core/Input.php +++ b/framework/core/Input.php @@ -303,18 +303,29 @@ public function getPost($index, $xss_clean = false) } /** - * Handle $_FILES - * + * Get single current uploaded file using $_FILES + * through Http Post * @param string $index * @return array|string */ public function file($index = '') { if ($index !== '') { - return isset($_FILES[$index]); + return $_FILES[$index]; } - return isset($_FILES); + return ''; + } + + /** + * Get all current uploaded files using $_FILES + * through Http Post + * + * @return array + */ + public function files() + { + return $_FILES; } /** @@ -326,8 +337,8 @@ public function file($index = '') public function hasFile($file) { return (empty($file['name'])) - ? true - : false; + ? false + : true; } /** @@ -338,7 +349,7 @@ public function hasFile($file) * @param string $name * @return string */ - public function storeFile($file, $path = '', $name = null) + public function storeFile($file = [], $path = '', $name = null) { if (empty($file)) { return '';