get_upload_space_available

The timeline below displays how wordpress function get_upload_space_available has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Determines if there is any upload space left in the current blog's quota.
 *
 * @since 3.0.0
 *
 * @return int of upload space available in bytes.
 */
function get_upload_space_available()
{
    $allowed = get_space_allowed();
    if ($allowed < 0) {
        $allowed = 0;
    }
    $space_allowed = $allowed * MB_IN_BYTES;
    if (get_site_option('upload_space_check_disabled')) {
        return $space_allowed;
    }
    $space_used = get_space_used() * MB_IN_BYTES;
    if ($space_allowed - $space_used <= 0) {
        return 0;
    }
    return $space_allowed - $space_used;
}

WordPress Version: 4.4

/**
 * Determines if there is any upload space left in the current blog's quota.
 *
 * @since 3.0.0
 *
 * @return int of upload space available in bytes
 */
function get_upload_space_available()
{
    $allowed = get_space_allowed();
    if ($allowed < 0) {
        $allowed = 0;
    }
    $space_allowed = $allowed * MB_IN_BYTES;
    if (get_site_option('upload_space_check_disabled')) {
        return $space_allowed;
    }
    $space_used = get_space_used() * MB_IN_BYTES;
    if ($space_allowed - $space_used <= 0) {
        return 0;
    }
    return $space_allowed - $space_used;
}

WordPress Version: 3.7

/**
 * Determines if there is any upload space left in the current blog's quota.
 *
 * @since 3.0.0
 *
 * @return int of upload space available in bytes
 */
function get_upload_space_available()
{
    $space_allowed = get_space_allowed() * 1024 * 1024;
    if (get_site_option('upload_space_check_disabled')) {
        return $space_allowed;
    }
    $space_used = get_space_used() * 1024 * 1024;
    if ($space_allowed - $space_used <= 0) {
        return 0;
    }
    return $space_allowed - $space_used;
}