get_upload_space_available

Determines if there is any upload space left in the current blog's quota.

Description

(int) get_upload_space_available(); 

Returns (int)

of upload space available in bytes


Usage

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

Defined (1)

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

/wp-includes/ms-functions.php  
  1. function get_upload_space_available() { 
  2. $allowed = get_space_allowed(); 
  3. if ( $allowed < 0 ) { 
  4. $allowed = 0; 
  5. $space_allowed = $allowed * MB_IN_BYTES
  6. if ( get_site_option( 'upload_space_check_disabled' ) ) 
  7. return $space_allowed; 
  8.  
  9. $space_used = get_space_used() * MB_IN_BYTES
  10.  
  11. if ( ( $space_allowed - $space_used ) <= 0 ) 
  12. return 0; 
  13.  
  14. return $space_allowed - $space_used;