Home » HTML » HTML_QuickForm » Bug #4930
HTML_Quickform maximum upload filesize should follow php.ini
Details
| Request #4930 | HTML_Quickform maximum upload filesize should follow php.ini |
|---|---|
| Submitted | 2005-07-27 13:57 UTC |
| From | weseman at gmail dot com |
| Status | Closed |
| Package | HTML_QuickForm |
| PHP Version | 4.3.11 |
| OS | OpenBSD |
| 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