bp_document_get_download_content_type( string $file_path )

Get content type of a download.

Description

Parameters

$file_path

(string) (Required) File path.

Return

(string)

Source

File: bp-document/bp-document-filters.php

function bp_document_get_download_content_type( $file_path ) {
	$file_extension = strtolower( substr( strrchr( $file_path, '.' ), 1 ) );
	$ctype          = 'application/force-download';

	foreach ( get_allowed_mime_types() as $mime => $type ) {
		$mimes = explode( '|', $mime );
		if ( in_array( $file_extension, $mimes, true ) ) {
			$ctype = $type;
			break;
		}
	}

	return $ctype;
}

Changelog

Changelog
Version Description
BuddyBoss 1.4.1 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.