bp_attachments_check_filetype( string $file, string $filename, array $allowed_mimes )

Check the uploaded attachment type is allowed.


Description Description


Parameters Parameters

$file

(Required) Full path to the file.

$filename

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

$allowed_mimes

(Required) The attachment allowed mimes (Required).


Top ↑

Return Return

(bool) True if the attachment type is allowed. False otherwise


Top ↑

Source Source

File: bp-core/bp-core-attachments.php

function bp_attachments_check_filetype( $file, $filename, $allowed_mimes ) {
	$filetype = wp_check_filetype_and_ext( $file, $filename, $allowed_mimes );

	if ( ! empty( $filetype['ext'] ) && ! empty( $filetype['type'] ) ) {
		return true;
	}

	return false;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.