validate_file


validate_file ( $file, $allowed_files = array() )

Parameters:
  • (string) file File path.
  • (string[]) allowed_files Optional. Array of allowed files.
Returns:
  • (int) 0 means nothing is wrong, greater than 0 means something was wrong.
Defined at:

Description

Validates a file name and path against an allowed set of rules.A return value of `1` means the file path contains directory traversal. A return value of `2` means the file path contains a Windows drive path. A return value of `3` means the file is not in the allowed files list.

Related Functions

validate_email, validate_file_to_edit, validate_plugin, list_files, wp_validate_boolean

Top Google Results

User discussions

wpseek mobile