Description
Determine if uploaded file exceeds space quota.
Usage
<?php check_upload_size( $file ); ?>
Parameters
- $file
- (array) (required) $_FILES array for a given file.
- Default: None
Returns
- (array)
- $_FILES array with 'error' key set if file exceeds quota. 'error' is empty otherwise.
Examples
<?php
$file = check_upload_size( $file );
if ( $file['error'] != '0' ) {
// The file was too large or has another error.
echo( $file['error'] );
} else {
// No errors, we can do stuff with $file here.
}
?>
Notes
- If there is an error and $_POST['html-upload'] is not set, this function will call wp_die() to display the error message and a back button.
Change Log
Source File
check_upload_size() is located in wp-admin/includes/ms.php
.