Validate::file_size_error( object $field )
Description #
Check if upload field file size is greater then allowed.
Parameters #
- $fieldobject (Required) Instance of @see
AP_Field
object.
Source #
File: lib/class-validate.php
private static function file_size_error( $field ) { $args = $field->get( 'upload_options' ); $value = $field->value(); $have_error = false; $is_numeric = wp_is_numeric_array( $value ); if ( true === $args['multiple'] && $is_numeric ) { foreach ( $value as $key => $file ) { if ( $file['size'] > ap_opt( 'max_upload_size' ) ) { $have_error = true; } } } elseif ( ! $is_numeric && $value['size'] > ap_opt( 'max_upload_size' ) ) { $have_error = true; } return $have_error; }
Expand full source code Collapse full source code View on GitHub: lib/class-validate.php:653
Add your comment