6
我有问题,下面的Zend表单抛出一个错误。 问题是“文件”元素和使用setElementDecorators。Zend文件上传和元素装饰器
class Products_AddForm extends Zend_Form
{
function init() {
// other form elements...
$uploadElement = new Zend_Form_Element_File('Excel');
$uploadElement->setLabel('Excel');
$this->addElement($uploadElement);
$this->setElementDecorators(array(
'ViewHelper',
'Errors',
array(array('data' => 'HtmlTag'), array('tag' => 'td')),
array('Label', array('tag' => 'th')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
));
}
}
这会引发错误。
(Warning: Exception caught by form: No file decorator found... unable to render file element Stack Trace: #0)
的SetElementDecorators
后,在结尾处增加$uploadElement->addDecorator('File');
会的工作,但是这会给我的文件元素的两倍!
有人可以帮忙吗?
TIA 马特
感谢你的帮助。添加这个抛出:警告:由窗体捕获的异常:方法getMaxFileSize不存在堆栈跟踪:#0 – frgtv10
已更新我的回答:) –
工作。 havnt在zend的文档中注意到了这一点!? :/ 谢谢! – frgtv10