Re: RE : [PEAR] [QuickForm] file upload and rules
| From: | Bertrand Mansion | Date: | Tue, 19 Nov 2002 17:25:19 +0000 |
| Subject: | Re: RE : [PEAR] [QuickForm] file upload and rules | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-2764@lists.php.net to get a copy of this message | ||
<yann@zebulon-fr.com> wrote :
> My code :
>
> ----------
> ...
> $form->addElement('text', 'username', 'Votre Pseudo');
> $form = new HTML_QuickForm('inscription', 'POST',
> $_SERVER['PHP_SELF']);
> $form->addElement('file', 'photo', 'Votre photo');
>
> $form->addRule('photo', 'La taille de votre photo ne doit pas excéder 30
> ko', 'maxfilesize', 30720);
> ...
> ----------
>
> It's work if I upload a file but if I don't upload a file, the rule work
> and the form is not submit. I want apply the rule only if the user want
> upload a file.
>
> I hope you understand me (my english is not good...;))
I understand. This will have to be fixed in the CVS, it can be considered as
a bug I think. Sorry, I am very busy now. I will have a look at it this
weekend... If you want to make a patch yourself, look at the _validate()
method in QuickForm.php (especially case 'function':).
Bertrand Mansion
Mamasam