Is there a way to filter_input_array
for $_FILES
?
I tried
$ar = filter_input_array(INPUT_FILES, $args);
but it doesn't seem to be the same syntax as $_POST:
$pd = filter_input_array(INPUT_POST, $args);
And after quick check of the Constants List shows that it isn't an installed definition for filter_input_array
.
So, should I define it some other way? DEFINE('INPUT_FILES' $_FILES);
likes to throw errors in filter_var_array
like
Warning: Constants may only evaluate to scalar values in .... Line 2
Warning: filter_input_array() expects parameter 1 to be long, string given .... Line 37
try using filter_var_array instead to filter $_FILES .
filter_var_array($_FILES, $filters);
You can't use filter_input_array on $_FILES
. None of the filter types are suitable for file uploads.
From the PHP manual on filter_input_array
:
mixed filter_input_array ( int $type [, mixed $definition ] )
type
One of INPUT_GET, INPUT_POST, INPUT_COOKIE, INPUT_SERVER, or INPUT_ENV.
How/what exactly did you want to filter from the files?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With