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