bp_attachments_check_filetype( string $file, string $filename, array $allowed_mimes )
Check the uploaded attachment type is allowed.
Description
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).
Return
(bool) True if the attachment type is allowed. False otherwise
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;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.