wp_check_filetype_and_ext

FUNCTION wp-includes\functions.php (ligne 3066) github
Attempts to determine the real file type of a file. If unable to, the file name extension will be used to determine type. If it's determined that the extension does not match the file's real type, then the "proper_filename" value will be set with a proper filename and extension. Currently this function only supports renaming images validated via wp_get_image_mime().

Paramètres

Entrée :
$file, $filename, $mimes = null
Sortie :
@param string        $file     Full path to the file.
@param string        $filename The name of the file (may differ from $file due to $file being
@param string[]|null $mimes    Optional. Array of allowed mime types keyed by their file extension regex.
@return array {

Utilisation

// Utilisation de la fonction wp_check_filetype_and_ext
$result = wp_check_filetype_and_ext($file, $filename, $mimes = null);

if ($result) {
    // Votre logique ici
}

Actualités

Chargement des actualités...