PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_QuickForm » Bug #4930

HTML_Quickform maximum upload filesize should follow php.ini

Details

Request #4930HTML_Quickform maximum upload filesize should follow php.ini
Submitted2005-07-27 13:57 UTC
Fromweseman at gmail dot com
StatusClosed
PackageHTML_QuickForm
PHP Version4.3.11
OSOpenBSD
Roadmaps(Not assigned)

Comments

[2005-07-27 13:57 UTC] weseman at gmail dot com

Description:
------------
HTML_Quickform uses a default maximum upload filesize of 1megabyte,
which is set through the private property _maxFileSize. IMO, it would be
better to follow the filesize specified by php.ini, as this is the value
that finally decides what size an upload can be.

Test script:
---------------
Place this in the constructor:

if (preg_match('/^([0-9]+)([a-zA-Z]*)$/',
ini_get('upload_max_filesize'), $matches)) {
// according to:
//
http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
// valid values are G, M or K, or no multiplier at all.
switch (strtoupper($matches['2'])) {
case 'G':
$this->_maxFileSize = $matches['1'] * 1073741824;
break;
case 'M':
$this->_maxFileSize = $matches['1'] * 1048576;
break;
case 'K':
$this->_maxFileSize = $matches['1'] * 1024;
break;
default:
$this->_maxFileSize = $matches['1'];
}
}

Expected result:
----------------
Now Quickform will use the value in php.ini for upload_max_filesize