upload_is_file_too_big() - WordPress 函数参考中文文档

返回介绍

upload_is_file_too_big()

发布于 2017-09-11 字数1435 浏览 759 评论 0

upload_is_file_too_big( array $upload )

Check whether an upload is too big.


描述


参数

$upload

(array)
(Required)


返回值

(string|array) If the upload is under the size limit, $upload is returned. Otherwise returns an error message.


源代码

File: wp-includes/ms-functions.php

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'] )  > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
		return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ) );
	}

	return $upload;
}

更新日志

Version 描述
MU Introduced.

相关函数

Uses

  • wp-includes/l10n.php:
    __()
  • wp-includes/option.php:
    get_site_option()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!