#33885 [NEW]: HTML_Quickform maximum upload filesize should follow php.ini

From: Date: Wed, 27 Jul 2005 13:38:19 +0000
Subject: #33885 [NEW]: HTML_Quickform maximum upload filesize should follow php.ini
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-82524@lists.php.net to get a copy of this message
From:             weseman at gmail dot com
Operating system: OpenBSD
PHP version:      4.3.11
PHP Bug Type:     Feature/Change Request
Bug description:  HTML_Quickform maximum upload filesize should follow php.ini

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.

Reproduce code:
---------------
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'];
            }
        }


-- 
Edit bug report at http://bugs.php.net/?id=33885&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33885&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33885&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33885&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33885&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33885&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33885&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33885&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33885&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33885&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33885&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=33885&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=33885&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33885&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33885&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33885&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33885&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33885&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33885&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33885&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33885&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#82524) next »