HTML_QuickForm - Check of uploaded file using custom function
| From: | Steffen Gebert | Date: | Mon, 29 Sep 2003 14:08:59 +0000 |
| Subject: | HTML_QuickForm - Check of uploaded file using custom function | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-8121@lists.php.net to get a copy of this message | ||
Hello,
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 avoid the use of checking the mime-type, b/c it made some failures
with some files that are JPEG-images, but not accepted. Also i'm not
really shure, what mimetypes for JPGs are... IE for example uses
image/pjpeg...
I couldn't find anything in the docu about such problems.
Thanx for your help,
Steffen