Re: QuickForm - missing $_FILES data
| From: | Bertrand Mansion | Date: | Sat, 05 Apr 2003 12:52:25 +0000 |
| Subject: | Re: QuickForm - missing $_FILES data | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-4658@lists.php.net to get a copy of this message | ||
<bfaulls@omphe.com> wrote :
> Bertrand Mansion wrote:
>> The easy solution would be
>> to use:
>> $form->addElement('file', 'imgfile'); instead of the createElement
>> above..
>> Otherwise, you will have to set the form attributes and the hidden field
>> manually. Tell me if it worked.
>>
>
> Yes this worked, I changed both createElement() calls to addElement().
> However now my submit button disappears when I validate the file and
> encounter errors. My error messages appear and the file dialog appears,
> but the submit button is gone.
Try with this:
$form->addElement('submit', 'submit', 'Submit');
> I am performing my own file validation, not using QuickForm as I
> probably should be. ( I presume this would mean instantiating the same
> Quickform and calling some methods. This functionality is fairly opaque
> to a newcomer.) Upon failure the script should add in error messages
> and then display the form again.
Look at the examples in the docs/ directory or search the archives for date
validation with QuickForm, the process would be the same for image
validation:
1. Create the validation function
2. Register it in QuickForm (registerRule)
3. Add it for the file element (addRule)
4. Call validate()
Good luck,
Bertrand Mansion
Mamasam