Skip to content
This repository was archived by the owner on Nov 18, 2025. It is now read-only.

Commit c51575f

Browse files
committed
✨ add files method
Signed-off-by: otengkwame <developerkwame@gmail.com>
1 parent b5f5818 commit c51575f

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

framework/core/Input.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,29 @@ public function getPost($index, $xss_clean = false)
303303
}
304304

305305
/**
306-
* Handle $_FILES
307-
*
306+
* Get single current uploaded file using $_FILES
307+
* through Http Post
308308
* @param string $index
309309
* @return array|string
310310
*/
311311
public function file($index = '')
312312
{
313313
if ($index !== '') {
314-
return isset($_FILES[$index]);
314+
return $_FILES[$index];
315315
}
316316

317-
return isset($_FILES);
317+
return '';
318+
}
319+
320+
/**
321+
* Get all current uploaded files using $_FILES
322+
* through Http Post
323+
*
324+
* @return array
325+
*/
326+
public function files()
327+
{
328+
return $_FILES;
318329
}
319330

320331
/**
@@ -326,8 +337,8 @@ public function file($index = '')
326337
public function hasFile($file)
327338
{
328339
return (empty($file['name']))
329-
? true
330-
: false;
340+
? false
341+
: true;
331342
}
332343

333344
/**
@@ -338,7 +349,7 @@ public function hasFile($file)
338349
* @param string $name
339350
* @return string
340351
*/
341-
public function storeFile($file, $path = '', $name = null)
352+
public function storeFile($file = [], $path = '', $name = null)
342353
{
343354
if (empty($file)) {
344355
return '';

0 commit comments

Comments
 (0)