WPDev.one
Core Function
View Source on Trac ↗

wp_check_filetype_and_ext()

wp_check_filetype_and_ext( mixed $file, mixed $filename, mixed $mimes = null )

Attempts to determine the real file type of a file.

Parameters 3 required

Name / Type Description
$file
string

Full path to the file.

Required
string

$filename The name of the file (may differ from $file due to $file being in a tmp directory).

Required
mixed

(string[] | null) $mimes Optional. Array of allowed mime types keyed by their file extension regex. Defaults to the result of get_allowed_mime_types().

Required

Return Value

(array)
array { Values for the extension, mime type, and corrected filename.

Function Information

Since Version
3.0.0
Source File
wp-includes/functions.php
Advertisement