public static function check_filetype_and_ext($checked, $file, $filename, $mimes) {
		// We don't care what WP has already done.
		$proper_filename = false;

		// Do basic extension validation and MIME mapping.
		$wp_filetype = mime::check_real_filetype($file, $filename, $mimes);
		$ext = $wp_filetype['ext'];
		$type = $wp_filetype['type'];

		// We can't do any further validation without a file to work with.
		if (!@file_exists($file)) {
			return compact('ext', 'type', 'proper_filename');
		}

		// If the type is valid, should we be renaming the file?
		if (false !== $ext && false !== $type) {
			$new_filename = mime::update_filename_extension($filename, $ext);
			if ($filename !== $new_filename) {
				$proper_filename = $new_filename;
			}
		}

		return compact('ext', 'type', 'proper_filename');
	}
public static function check_filetype_and_ext($checked, $file, $filename, $mimes) {
		// We don't care what WP has already done.
		$proper_filename = false;

		// Do basic extension validation and MIME mapping.
		$wp_filetype = mime::check_real_filetype($file, $filename, $mimes);
		$ext = $wp_filetype['ext'];
		$type = $wp_filetype['type'];

		// We can't do any further validation without a file to work with.
		if (!@file_exists($file)) {
			return compact('ext', 'type', 'proper_filename');
		}

		// If the type is valid, should we be renaming the file?
		if (false !== $ext && false !== $type) {
			$new_filename = mime::update_filename_extension($filename, $ext);
			if ($filename !== $new_filename) {
				$proper_filename = $new_filename;
			}
		}

		return compact('ext', 'type', 'proper_filename');
	}
public static function check_filetype_and_ext ( $ checked , $ file , $ filename , $ mimes ) { // We don't care what WP has already done. $ proper_filename = false ; // Do basic extension validation and MIME mapping. $ wp_filetype = mime :: check_real_filetype ( $ file , $ filename , $ mimes ) ; $ ext = $ wp_filetype [ 'ext' ] ; $ type = $ wp_filetype [ 'type' ] ; // We can't do any further validation without a file to work with. if ( ! @ file_exists ( $ file ) ) { return compact ( 'ext' , 'type' , 'proper_filename' ) ; } // If the type is valid, should we be renaming the file? if ( false !== $ ext && false !== $ type ) { $ new_filename = mime :: update_filename_extension ( $ filename , $ ext ) ; if ( $ filename !== $ new_filename ) { $ proper_filename = $ new_filename ; } } return compact ( 'ext' , 'type' , 'proper_filename' ) ; }
Override Upload File Validation

This hooks into wp_check_filetype_and_ext() to improve its
determinations.

@see wp_check_filetype_and_ext()

@param array $checked Previous check status.
@param string $file File path.
@param string $filename File name.
@param array $mimes Mimes.
@return array Checked status.
Override Upload File Validation