upload_is_file_too_big()判断上传的文件是否过大

目录

描述

Check whether an upload is too big.

upload_is_file_too_big() 描述

用法

<?php upload_is_file_too_big$upload ); ?>

upload_is_file_too_big() 用法

参数

$upload

(array) (必填) ????

默认值: None

upload_is_file_too_big() 参数

示例

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */

upload_is_file_too_big() 示例

历史

添加于 版本: MU

upload_is_file_too_big() 历史

源文件

upload_is_file_too_big() 函数的代码位于 wp-includes/ms-functions.php

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * 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; }

upload_is_file_too_big() 源文件

相关