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

  • (string) $file File path.
  • (array) $allowed_files Optional. List of allowed files.
  • (int) 0 means nothing is wrong, greater than 0 means something was wrong.
Defined at:


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