上传框架扩展名.swf php

发布于 2024-11-05 21:09:08 字数 1992 浏览 1 评论 0原文

我想上传 .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' => ''
    ));
}

i want to upload a .swf format and i am getting an exception "false extension" and i tried to put a validator on the extension and it still didn't work any ideas how to upload .swf and do i need a special uploader. This is my form code.

class Admin_Form_Banner extends 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' => ''
    ));
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小矜持 2024-11-12 21:09:08

那么它是一个 Zend_Form_Element_Hidden 你怎么能从该元素接收文件上传?
也许您已经进行了一些自定义以允许这样做,但我们无法通过这个有限的代码示例来真正猜测。

Well it's a Zend_Form_Element_Hidden how could you receive a fileupload from that element ?
Maybe you've made some customization to allow that but we can't really guess with this limited code sample.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文