bp_attachments_get_max_upload_file_size

Get the max upload file size for any attachment.

Description

(int) bp_attachments_get_max_upload_file_size( (string) $type = '' ); 

Returns (int)

Max upload file size for any attachment.

Parameters (1)

0. $type — Optional. (string) => ''
A string to inform about the type of attachment we wish to get the max upload file size for.

Usage

  1. if ( !function_exists( 'bp_attachments_get_max_upload_file_size' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-attachments.php'; 
  3.  
  4. // A string to inform about the type of attachment 
  5. // we wish to get the max upload file size for. 
  6. $type = ''; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = bp_attachments_get_max_upload_file_size($type); 
  10.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-attachments.php  
  1. function bp_attachments_get_max_upload_file_size( $type = '' ) { 
  2. $fileupload_maxk = bp_core_get_root_option( 'fileupload_maxk' ); 
  3.  
  4. if ( '' === $fileupload_maxk ) { 
  5. $fileupload_maxk = 5120000; // 5mb; 
  6. } else { 
  7. $fileupload_maxk = $fileupload_maxk * 1024; 
  8.  
  9. /** 
  10. * Filter here to edit the max upload file size. 
  11. * @since 2.4.0 
  12. * @param int $fileupload_maxk Max upload file size for any attachment. 
  13. * @param string $type The attachment type (eg: 'avatar' or 'cover_image'). 
  14. */ 
  15. return apply_filters( 'bp_attachments_get_max_upload_file_size', $fileupload_maxk, $type );