Skip to content

Commit

Permalink
✨ add files method
Browse files Browse the repository at this point in the history
Signed-off-by: otengkwame <developerkwame@gmail.com>
  • Loading branch information
otengkwame committed Apr 27, 2022
1 parent b5f5818 commit c51575f
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions framework/core/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -326,8 +337,8 @@ public function file($index = '')
public function hasFile($file)
{
return (empty($file['name']))
? true
: false;
? false
: true;
}

/**
Expand All @@ -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 '';
Expand Down

0 comments on commit c51575f

Please sign in to comment.