QuickForm - fileupload - maxfilesize warning problem!
| From: | Tommy Ipsen | Date: | Fri, 09 May 2003 20:02:51 +0000 |
| Subject: | QuickForm - fileupload - maxfilesize warning problem! | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5285@lists.php.net to get a copy of this message | ||
Hi everybody
When I'm using a file-control in QuickForm I have the possibility to specify the maxfilesize of the file using a rule like:
$form->addRule('myfile', 'Files cannot exceed 512KB', 'maxfilesize', 524288);
If I try to upload larger files I get the appropriate warning message in the form - just like I specified in the rule above - just the way I like it!
However in the QuickForm module there's also this piece of code:
/**
* Value for maxfilesize hidden element if form contains file input
* @since 1.0
* @var integer
* @access public
*/
var $_maxFileSize = 1048576; // 1 Mb = 1048576
Which by default places a hidden element in my form with a maxfilesize of 1MB - this is ok, since I can just change this value if I'm not satisfied but if the uploaded file is larger than this _maxFileSize I get a warning in the beginning of the page (before any php is executed at all!) completely breaking my page design:
Warning: MAX_FILE_SIZE of 1048576 bytes exceeded - file [myfile=nameofuploadedfile.ext] not saved in Unknown on line 0
This might be due to my error_reporting level being set to E_ALL but it should be possible to control this error as well as overriding the default value of _maxFileSize in QuickForm! Perhaps the value should follow the value in the rule or maybe the value specified in php.ini?
I don't know whether this is a bug or a feature but I would sure like to know how to bypass the problem!
Regards,
Tommy Ipsen
PS: Bertrand - Thanks for an otherwise great class!