Source
return _s('File is too big, max upload size is %1$s bytes.', self::getMaxUploadSize());
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
class CUploadFile {
protected $name;
protected $type;
protected $tmp_name;
protected $error;
protected $size;
/**
* Get upload_max_filesize value in bytes defined in php.ini.
* If value is not defined in php.ini, returns default 2M.
*
* @static
*
* @return int
*/
static public function getMaxUploadSize() {
$maxSize = trim(ini_get('upload_max_filesize'));
if ($maxSize === '') {
$maxSize = '2M'; // PHP default value
}
return str2mem($maxSize);
}
/**
* Accepts file array from $_FILES global variable.
*
* @throws Exception if file_uploads are disabled
*
* @param $file
*/
public function __construct($file) {
if (!ini_get('file_uploads')) {
throw new Exception(_('Unable to upload file because "file_uploads" is disabled.'));
}
$this->name = $file['name'];
$this->type = $file['type'];
$this->tmp_name = $file['tmp_name'];
$this->error = $file['error'];