Hi I have problem with File element on my custom zend_form. Thats the code:
class Core_Form extends Zend_Form
{
protected $_containerId;
public function __construct($options = null) {
parent::__construct($options);
$this->setElementDecorators(array(
'ViewHelper',
array(
'Description',
array(
'tag' => 'div',
'class' => 'submit-button',
'escape' => false
)
),
array(
array(
'data' => 'HtmlTag'
),
array(
'tag' => 'div',
'class' => 'element'
)
),
array(
'Label',
array(
'tag' => 'div',
'escape' => false
)
),
array(
array(
'row' => 'HtmlTag'
),
array(
'tag' => 'div',
'class' => 'element-row'
),
),
'Errors'
));
$this->setDecorators(array(
'FormElements',
array(
'HtmlTag',
array(
'tag' => 'div',
'id' => $this->_containerId
)
),
'Form',
'Errors'
));
}
}
//upload form
class Upload_Form extends Core_Form
{
public function init()
{
/* Form Elements & Other Definitions Here ... */
$this->addElement('file', 'uploadFile', array(
'destination' => APPLICATION_PATH.'/../public/uploads/ads',
'validators' => array(
array('count', false, 1),
array('size', false, 102400),
),
'label' => 'Wyślij plik:'
));
$this->addElement('image', 'submit', array(
'label' => false,
'ignore' => true,
'src' => $this->getView()->baseUrl('images/send.jpg')
));
$this->setEnctype('multipart/form-data');
}
}
i getting this error: Warning: Exception caught by form: No file decorator found... unable to render file element
when I change my ViewHelper in element decorators to 'File' i getting this error: Warning: Exception caught by form: Method getMaxFileSize does not exist Stack Trace: #0 [internal function]: Zend_Form_Element->__call('getMaxFileSize', Array)
Thank you in advance for your help