upload_is_file_too_big

Check whether an upload is too big.

Description

(string|array) upload_is_file_too_big( (array) $upload ); 

Returns (string|array)

If the upload is under the size limit, $upload is returned. Otherwise returns an error message.

Parameters (1)

0. $upload (array)
The upload.

Usage

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

Defined (1)

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

/wp-includes/ms-functions.php  
  1. function upload_is_file_too_big( $upload ) { 
  2. if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) ) 
  3. return $upload; 
  4.  
  5. if ( strlen( $upload['bits'] ) > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) { 
  6. return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ) ); 
  7.  
  8. return $upload;