bp_core_upload_max_size()
Return the file upload max size in bytes.
Description
Return
(mixed|void)
Source
File: bp-core/bp-core-functions.php
function bp_core_upload_max_size() { static $max_size = - 1; if ( $max_size < 0 ) { // Start with post_max_size. $size = @ini_get( 'post_max_size' ); $unit = preg_replace( '/[^bkmgtpezy]/i', '', $size ); // Remove the non-unit characters from the size. $size = preg_replace( '/[^0-9\.]/', '', $size ); // Remove the non-numeric characters from the size. if ( $unit ) { $post_max_size = round( $size * pow( 1024, stripos( 'bkmgtpezy', $unit[0] ) ) ); } else { $post_max_size = round( $size ); } if ( $post_max_size > 0 ) { $max_size = $post_max_size; } // If upload_max_size is less, then reduce. Except if upload_max_size is // zero, which indicates no limit. $size = @ini_get( 'upload_max_filesize' ); $unit = preg_replace( '/[^bkmgtpezy]/i', '', $size ); // Remove the non-unit characters from the size. $size = preg_replace( '/[^0-9\.]/', '', $size ); // Remove the non-numeric characters from the size. if ( $unit ) { $upload_max = round( $size * pow( 1024, stripos( 'bkmgtpezy', $unit[0] ) ) ); } else { $upload_max = round( $size ); } if ( $upload_max > 0 && $upload_max < $max_size ) { $max_size = $upload_max; } } /** * Filters file upload max limit. * * @param mixed $max_size file upload max limit. * * @since BuddyBoss 1.4.8 */ return apply_filters( 'bp_core_upload_max_size', $max_size ); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.8 | 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.