Skip to content
Advertisement

PHP filter_input_array for $_FILES?

Is there a way to filter_input_array for $_FILES?

I tried

JavaScript

but it doesn’t seem to be the same syntax as $_POST:

JavaScript

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

JavaScript

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:

JavaScript

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?

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement