wp_check_filetype_and_ext


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

Parameters:
  • (string) $file Full path to the file.
  • (string) $filename The name of the file (may differ from $file due to $file being in a tmp directory).
  • (array) $mimes Optional. Key is the file extension with value as the mime type.
Returns:
  • (array) Values for the extension, MIME, and either a corrected filename or false if original $filename is valid.
Defined at:

Description

Attempt 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().

Related Functions

wp_check_filetype, wp_check_for_changed_dates, wp_check_invalid_utf8, wp_check_locked_posts, wp_check_for_changed_slugs

Top Google Results

User discussions

wpseek mobile