WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/check upload size

Contents

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.

See also index of Function Reference and index of Template Tags.
This article is marked as in need of editing. You can help Codex by editing it.