我想上传一个.swf格式,我得到一个例外“虚假扩展”,我试图在扩展上放一个验证器,它仍然没有任何想法如何上传.swf,我需要一个特殊上传者。这是我的表格代码。
类Admin_Form_Banner扩展了ZendX_Form_Designed {
public function init() {
$this->setEnctype(self::ENCTYPE_MULTIPART);
$this->setMethod(self::METHOD_POST);
$this->setMethod('post');
// Add an email element
$this->addElement('text', 'banner_title', array(
'label' => 'Banner Title',
'required' => true,
"class" => 'required',
'filters' => array('StringTrim')
));
$this->addElement('select','banner_type',array(
'label'=>'type',
'required'=>TRUE,
'class'=>'required',
'multiOptions'=>array('1'=>'Image','2'=>'Flash','3'=>'HTML')
));
$this->addElement('text', 'banner_link', array(
'label' => 'Banner Link',
'required' => true,
"class" => 'required url',
'value'=>'http://www.',
'filters' => array('StringTrim'),
));
$this->addElement('select','link_open',array(
'label'=>'choose how do you want the link to open ?',
'required'=>TRUE,
'multiOptions'=>array('self'=>'Same Page','_new'=>'Tab Page')
));
$this->addElement('checkbox', 'is_active', array(
'label' => 'Is Active',
'required' => true,
"class" => 'required',
'filters' => array('StringTrim')
));
$banner_position = new Zend_Form_Element_Select('banner_position');
$banner_position->setMultiOptions($this->getBannerPositions())->setLabel('Banner Position');
$this->addElement($banner_position, 'banner_position');
$this->addElement('hidden', 'file_path', array(
'required' => true,
"class" => 'required',
'Extension'=>'.swf'
));
$this->addElement('submit', 'submit', array(
'ignore' => true,
'label' => ''
));
}
答案 0 :(得分:1)
那么它是Zend_Form_Element_Hidden你怎么能从该元素接收文件上传? 也许您已经进行了一些自定义以允许这样做,但我们无法用这个有限的代码示例来猜测。