[SMARTY] What's wrong with this SmartyValidate
"Reynier Perez Mira" <[email protected]>
| Newsgroups | gmane.comp.php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
Well I continue with my form validation using SmartyValidate plugin. Now I try to use the validators for image elements. See the code below:
PHP:
----
SmartyValidate::register_validator('fimagen_type','aImagen:jpg,gif,png','isFileType');
SmartyValidate::register_validator('fimagen_size','aImagen:250k','isFileSize');
TPL:
----
<input name="aImagen" type="file" id="aImagen" />
<div class="errormsg">
{validate id="fimagen_type" field="aImagen" message="Solo los siguientes tipos de extensiones son permitidos: PNG, JPG/JPEG, GIF"}
{validate id="fimagen_size" field="aImagen" message="El peso de la imagen no puede exceder los 250kb"}
</div>
As you can see I register two different validators. One for image type and other for image size. When I pick in "Examine" button and search a file in my HDD that perform the validation criteria, for example:
1) file1.jpg - 125kb
I obtain always these PHP notice:
Quote:
------
Notice: Undefined index: aImagen in D:\Server\WWWRoot\ecommerce\smarty\SmartyValidate.class.php on line 225
Notice: Undefined index: aImagen in D:\Server\WWWRoot\ecommerce\smarty\SmartyValidate.class.php on line 241
Notice: Undefined index: aImagen in D:\Server\WWWRoot\ecommerce\smarty\SmartyValidate.class.php on line 255
Notice: Undefined index: aImagen in D:\Server\WWWRoot\ecommerce\smarty\SmartyValidate.class.php on line 225
Notice: Undefined index: aImagen in D:\Server\WWWRoot\ecommerce\smarty\SmartyValidate.class.php on line 225
Notice: Undefined index: aImagen in D:\Server\WWWRoot\ecommerce\smarty\SmartyValidate.class.php on line 241
Notice: Undefined index: aImagen in D:\Server\WWWRoot\ecommerce\smarty\SmartyValidate.class.php on line 255
One another thing is if I leave the Image Field empty and not try to upload any file, then I always obtain this notice or warnings?
Regards
ReynierPM
4to. año Ing. Informática
Usuario registrado de Linux: #310201
*************************************************************************
El programador superhéroe aprende de compartir sus conocimientos.
Es el referente de sus compañeros. Todo el mundo va a preguntarle y él, secretamente, lo fomenta porque es así como adquiere su legendaria
sabiduría: escuchando ayudando a los demás...
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php