Quickform maxFileSize request for change in behaviour
| From: | Yuri Weseman | Date: | Wed, 27 Jul 2005 10:19:33 +0000 |
| Subject: | Quickform maxFileSize request for change in behaviour | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-38965@lists.php.net to get a copy of this message | ||
Hi,
Today I tried uploading a file using Quickform. It works, but only when your
files are smaller than 1MB. Quickform uses a hidden input field, named
MAX_FILE_SIZE. This prevents files larger than that size from being upoaded..
The value is hardcoded to 1 megabyte in Quickform.php. I'd like to suggest
to change this behaviour. I've added a patch file, that shows the change.
The patch file was created with diff on version 3.2.4pl1 (QuickForm.php,v
1.151).
In the constructor of Quickform.php I would add a check for the value of
upload_max_filesize. If it is correctly set, we can use this value to set
the default behaviour to use this value instead of 1MB.
Kind regards,
Yuri
256,274d255 < 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']; < } < } <
256,274d255 < 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']; < } < } <