validate_file
validate_file ( $file, $allowed_files = array() )
Parameters:- (string) file File path.
- (string[]) allowed_files Optional. Array of allowed files. Default empty array.
Returns:- (int) 0 means nothing is wrong, greater than 0 means something was wrong.
Defined at: - Introduced in WordPress: 1.2.0
- Deprecated in WordPress: —
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.