Re: HTML_QuickForm - Check of uploaded file using custom function
| From: | Alexey Borzov | Date: | Mon, 29 Sep 2003 14:25:06 +0000 |
| Subject: | Re: HTML_QuickForm - Check of uploaded file using custom function | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8125@lists.php.net to get a copy of this message | ||
Hi!
Steffen Gebert wrote:
i'm using HTML_QuickForm and HTML_QuickForm_Controller to build a mulit-page Wizard for sign-in in a community. in one of the steps users may upload one (at the moment, later more) image. So i want to check, if the uploaded file is really an image, so that my process-script will be able to save an scale it down. I've tried the following Code: $file =& $this->addElement('file', 'pic1', 'Your Pictore:'); $this->addRule('pic1', 'Not an image', 'function', 'CheckImage', 'validation'); But validation::CheckImage() is never executed. I've also tried to place the function in the HTML_QuickForm_Page and deleted the 'validation'- element of the rule, but it doesn't help.I suggest to a) either check the return value of the functions that can throw errors (e.g. addRule) or set the global error handling: PEAR::setErrorHandling(PEAR_ERROR_DIE); b) consult the documentation on rules: http://pear.php.net/manual/en/package.html.html-quickform.intro-validation.php