What's wrong with this SmartyValidate
| From: | Reynier Perez Mira | Date: | Sat, 04 Feb 2006 04:00:31 +0000 |
| Subject: | What's wrong with this SmartyValidate | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-13301@lists.php.net to get a copy of this message | ||
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...