1. 首页
  2. WordPress 函数手册

upload_is_file_too_big()

upload_is_file_too_big( array $upload )

检查上载是否太大。
Check whether an upload is too big.

目录锚点:#参数#源码


参数(Parameters)

参数 类型 说明
$upload (array)

源码(Source)

/**
 * Check whether an upload is too big.
 *
 * @since MU
 *
 * @param array $upload
 * @return string|array If the upload is under the size limit, $upload is returned. Otherwise returns an error message.
 */
function upload_is_file_too_big( $upload ) {
	if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) )
		return $upload;

	if ( strlen( $upload['bits'] )  > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) )
		return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '', get_site_option( 'fileupload_maxk', 1500 ));

	return $upload;
}
更新版本 源码位置 使用 被使用
MU (3.0.0) wp-includes/ms-functions.php 10 18

upload_is_file_too_big() 为WP2原创文章,链接:https://www.wp2.cn/functions/upload_is_file_too_big/