wp_max_upload_size

Determines the maximum upload size allowed in php.ini.

Description

(int) wp_max_upload_size(); 

Returns (int)

Allowed upload size.


Usage

  1. if ( !function_exists( 'wp_max_upload_size' ) ) { 
  2. require_once ABSPATH . WPINC . '/media.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_max_upload_size(); 
  7.  

Defined (1)

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

/wp-includes/media.php  
  1. function wp_max_upload_size() { 
  2. $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); 
  3. $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); 
  4.  
  5. /** 
  6. * Filters the maximum upload size allowed in php.ini. 
  7. * @since 2.5.0 
  8. * @param int $size Max upload size limit in bytes. 
  9. * @param int $u_bytes Maximum upload filesize in bytes. 
  10. * @param int $p_bytes Maximum size of POST data in bytes. 
  11. */ 
  12. return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );