php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #33885 HTML_Quickform maximum upload filesize should follow php.ini
Submitted: 2005-07-27 15:38 UTC Modified: 2005-07-27 15:43 UTC
From: weseman at gmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.3.11 OS: OpenBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: weseman at gmail dot com
New email:
PHP Version: OS:

 

 [2005-07-27 15:38 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.

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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-27 15:43 UTC] tony2001@php.net
Please report PEAR issues into the PEAR bug system:
http://pear.php.net/bugs/
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 10:01:34 2025 UTC