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
Advertisement
Answer
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?