当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_Element_File::setMultiFile方法代码示例

本文整理汇总了PHP中Zend_Form_Element_File::setMultiFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_File::setMultiFile方法的具体用法?PHP Zend_Form_Element_File::setMultiFile怎么用?PHP Zend_Form_Element_File::setMultiFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_Element_File的用法示例。


在下文中一共展示了Zend_Form_Element_File::setMultiFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $signedUserInfo = $registry->get('signedUserInfo');
     $uploadStatus = $registry->get("uploadStatus");
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $file = new Zend_Form_Element_File('file');
     $file->setRequired(false);
     $file->setLabel('What do you want to share today?');
     if ($uploadStatus['bandwidth']['remainingbytes'] > 0) {
         $maxFileSize = $uploadStatus['filesize']['maxbytes'];
     } else {
         $maxFileSize = 0;
     }
     $file->addValidator('Size', false, $maxFileSize);
     $file->setMaxFileSize($maxFileSize);
     $file->setMultiFile(4);
     $file->addValidator('Count', false, array('min' => 0, 'max' => 4));
     $this->addElement($file, 'file');
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('submit', 'submitupload', array('label' => 'Upload!', 'class' => 'btn primary'));
     $this->setAttrib('class', 'form-stacked');
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:26,代码来源:Upload.php

示例2: indexAction

 /**
  * The default action - show the home page
  */
 public function indexAction()
 {
     // Create form
     $form = new Zend_Form();
     $form->setEnctype('multipart/form-data');
     // File element...
     $fileEle = new Zend_Form_Element_File("projectImage", array('label' => 'Image File:'));
     $fileEle->setMultiFile(3);
     // Add elements + submit button
     $form->addElements(array($fileEle, new Zend_Form_Element_Submit('projectSubmitImageUpload', array('label' => 'Upload Image'))));
     // Show the form
     echo $form;
     // Check if we have a form post, and if it's valid
     if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
         // you'll never get here!
     }
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:20,代码来源:TestController.php

示例3: init

 public function init()
 {
     $this->form = new Image_Form_Edit();
     $this->form->removeElement(Image::COL_ID);
     $this->form->removeElement(Image::COL_ORIGINAL_FILENAME);
     //create the upload element-----------------------------
     $element = new Zend_Form_Element_File('uploadElement');
     $path = __FILE__;
     $path = dirname($path);
     $path = dirname($path);
     $path = dirname($path);
     $path = dirname($path);
     $path = dirname($path);
     $element->setLabel('Upload image(s):')->setDestination($path . '/public/images');
     // ensure minimum 1, maximum 4 files
     $element->addValidator('Count', false, array('min' => 1, 'max' => 4));
     // limit to 100K
     //$element->addValidator('Size', false, 102400);
     // only JPEG, PNG, and GIFs
     $element->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     // defines 4 identical file elements
     $element->setMultiFile(4);
     $element->setOrder(0);
     $this->form->addElement($element);
     //------------------------------------------------------
     $fishSampleCode = new Zend_Form_Element_Text(Fish::COL_SAMPLE_CODE);
     $fishSampleCode->setLabel('Fish Sample Code:');
     $fishSampleCode->setOrder(1);
     $this->form->addElement($fishSampleCode);
     //#####################new###################################
     $this->form->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'login_form')), array('Description', array('placement' => 'prepend')), 'Form'));
     $this->form->setElementDecorators(array('ViewHelper', 'Errors', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))));
     $element->setDecorators(array('File', 'Errors', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))));
     //###########################################################
     $this->view->form = $this->form;
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:36,代码来源:UploadController.php

示例4: getFormElement

 function getFormElement($v, $value = '')
 {
     $this->toTpl('hasForm', 1);
     $v = $this->doQoolHook('front_pre_getformelement_element', $v);
     $value = $this->doQoolHook('front_pre_getformelement_value', $value);
     switch ($v['value']) {
         case "editor":
             $this->loadEditorBtns();
             $this->toTpl("loadEditor", 1);
             $this->toTpl("isEditor", 1);
             $element = new Zend_Form_Element_Textarea($v['name']);
             $element->setAttrib('class', 'editor span12');
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "fileinput":
             $element = new Zend_Form_Element_File($v['name']);
             $element->setAttrib('class', 'input-file');
             break;
         case "captcha":
             $element = new Zend_Form_Element_Captcha($v['name'], array('label' => $this->t("Please verify you are a human"), 'captcha' => $config->site->captcha_adapter, 'captchaOptions' => array('captcha' => $config->site->captcha_adapter, 'wordLen' => 6, 'timeout' => 300)));
             return $element;
             break;
         case "multifileinputs":
             $element = new Zend_Form_Element_File($v['name']);
             $element->setAttrib('class', 'input-file');
             $element->setMultiFile(10);
             break;
         case "multifileinput":
             $name = $v['name'] . "[]";
             $element = new Zend_Form_Element_File($name);
             $element->setAttrib('class', 'input-file');
             $element->setAttrib('multiple', 'multiple');
             $element->setMultiFileForQool(1);
             $this->toTpl('filelist', true);
             break;
         case "checkbox":
             $element = new Zend_Form_Element_Checkbox($v['name']);
             $element->setAttrib('class', 'checkbox');
             $element->setValue($value);
             break;
         case "editarea":
             $this->toTpl('editarea', 1);
             $element = new Zend_Form_Element_Textarea($v['name']);
             $element->setAttrib('class', 'editarea span12');
             $element->setAttrib('id', 'editarea');
             $element->setAttrib('style', 'height:500px');
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "password":
             $element = new Zend_Form_Element_Password($v['name']);
             break;
         case "textarea":
             $element = new Zend_Form_Element_Textarea($v['name']);
             $element->setAttrib('class', 'span9');
             $element->setAttrib('style', 'height:80px');
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "hidden":
             $element = new Zend_Form_Element_Hidden($v['name']);
             $element->setValue($value);
             $element->setDecorators(array("ViewHelper"));
             break;
         case "textinput":
             $element = new Zend_Form_Element_Text($v['name']);
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "selectbox":
             $element = new Zend_Form_Element_Select($v['name']);
             if ($v['use_pool'] && method_exists($this, $v['use_pool'])) {
                 if ($v['pool_type'] != '0') {
                     $this->pool_type = $v['pool_type'];
                 }
                 if ($v['novalue']) {
                     $element->addMultiOption(0, $this->t('No Selection'));
                 }
                 foreach ($this->{$v}['use_pool']() as $ko => $vo) {
                     if ($v['noself'] && $vo['id'] == $v['noself']) {
                     } else {
                         $element->addMultiOption($vo['id'], $vo['title']);
                     }
                 }
                 if ($value != '') {
                     $element->setValue($value);
                 }
             }
             break;
         case "multiselectbox":
             $element = new Zend_Form_Element_Multiselect($v['name']);
             if ($v['use_pool'] && method_exists($this, $v['use_pool'])) {
                 if ($v['pool_type'] != '0') {
                     $this->pool_type = $v['pool_type'];
                 }
//.........这里部分代码省略.........
开发者ID:basdog22,项目名称:Qool,代码行数:101,代码来源:Action.php

示例5: init

 /**
  * Inicializace formulare
  *
  */
 public function init()
 {
     $this->setMethod(self::METHOD_POST);
     // ################## FIRST COLUMN ###################
     // Photo (id_foto)
     // File picker
     $profilePhotoPicker = new Zend_Form_Element_File('profilePhoto');
     $profilePhotoPicker->setDestination(PUBLIC_PATH . '/temp');
     $profilePhotoPicker->addValidator('Count', false, 1);
     $profilePhotoPicker->addValidator('Size', false, 2097152);
     $profilePhotoPicker->removeDecorator('Label');
     $this->addElement($profilePhotoPicker, 'profilePhoto');
     $avatar = new Zend_Form_Element_Image('avatar');
     $avatar->setAttrib('class', array("profile-user-img", "img-responsive", "img-circle"));
     $this->addElement($avatar, 'avatar');
     // First name (jmeno)
     $firstName = $this->createElement('text', 'jmeno');
     $firstName->addFilter('StringTrim');
     $firstName->setRequired(true);
     $firstName->setAttrib('class', 'form-control');
     $firstName->setAttrib('placeholder', 'First name');
     $firstName->removeDecorator('Label');
     $this->addElement($firstName);
     // Last name (prijmeni)
     $lastName = $this->createElement('text', 'prijmeni');
     $lastName->addFilter('StringTrim');
     $lastName->setRequired(true);
     $lastName->setAttrib('class', 'form-control');
     $lastName->setAttrib('placeholder', 'Surname');
     $lastName->removeDecorator('Label');
     $this->addElement($lastName);
     // Date of birth (datum_narozeni)
     // Date picker
     $birthdate = $this->createElement('text', 'datum_narozeni');
     $birthdate->setRequired(true);
     $birthdate->setAttrib('class', array('form-control', 'date-picker'));
     $birthdate->removeDecorator('Label');
     $birthdate->setAttrib('placeholder', 'Birthdate');
     $this->addElement($birthdate);
     // ################## SECOND COLUMN ##################
     // Status (id_status)
     // Select box
     $status = new Zend_Form_Element_Select('id_status');
     $status->removeDecorator('Label');
     $status->setAttrib('class', 'form-control');
     $this->addElement($status, 'id_status');
     // Position (id_pozice)
     // Select box
     $position = new Zend_Form_Element_Select('id_pozice');
     $position->removeDecorator('Label');
     $position->setAttrib('class', 'form-control');
     $this->addElement($position, 'id_pozice');
     // Technology (kandidat_technologie)
     // Multi select
     $technology = new Zend_Form_Element_Multiselect('kandidat_technologie');
     $technology->removeDecorator('Label');
     $technology->setAttrib('class', 'form-control');
     $this->addElement($technology, 'kandidat_technologie');
     // Seniority (id_seniorita)
     // Select box
     $seniority = new Zend_Form_Element_Select('id_seniorita');
     $seniority->removeDecorator('Label');
     $seniority->setAttrib('class', 'form-control');
     $this->addElement($seniority, 'id_seniorita');
     // Comment (komentar)
     $comment = $this->createElement('textarea', 'komentar');
     $comment->addFilter('StringTrim');
     $comment->setAttrib('class', 'form-control');
     $comment->setAttrib('rows', '3');
     $comment->setAttrib('placeholder', 'Enter your comment…');
     $comment->removeDecorator('Label');
     $this->addElement($comment);
     // ################### ATTACHEMENTS ###################
     // Attchements (kandidat_priloha)
     // File picker
     $attachments = new Zend_Form_Element_File('attachments');
     $attachments->setDestination(PUBLIC_PATH . '/temp');
     $attachments->addValidator('Count', false, array('min' => 0, 'max' => 4));
     $attachments->addValidator('Size', false, 2097152);
     $attachments->setMultiFile(4);
     $attachments->removeDecorator('Label');
     $this->addElement($attachments, 'attachments');
     $attachmentsCheckGroup = new Zend_Form_Element_MultiCheckbox('attachmentsCheckGroup');
     $comment->removeDecorator('Label');
     $this->addElement($attachmentsCheckGroup, 'attachmentsCheckGroup');
     // ###################### BUTTON ######################
     $close = new Zend_Form_Element_Submit('closeButton');
     $close->setLabel('Back');
     $close->setAttrib('class', 'btn btn-default');
     $close->setDecorators(array('ViewHelper'));
     $this->addElement($close, 'closeButton');
     $save = new Zend_Form_Element_Submit('saveButton');
     $save->setLabel('Save');
     $save->setAttrib('class', 'btn btn-success');
     $save->setDecorators(array('ViewHelper'));
     $this->addElement($save, 'saveButton');
//.........这里部分代码省略.........
开发者ID:cngroupdk,项目名称:InterviewMe_Tym1,代码行数:101,代码来源:CandidateForm.php

示例6: testMultiFileWithOneFile

 public function testMultiFileWithOneFile()
 {
     $form = new Zend_Form();
     $element = new Zend_Form_Element_File('file');
     $element->setMultiFile(1);
     $subform0 = new Zend_Form_SubForm();
     $subform0->addElement($element);
     $subform1 = new Zend_Form_SubForm();
     $subform1->addSubform($subform0, 'subform0');
     $subform2 = new Zend_Form_SubForm();
     $subform2->addSubform($subform1, 'subform1');
     $subform3 = new Zend_Form_SubForm();
     $subform3->addSubform($subform2, 'subform2');
     $form->addSubform($subform3, 'subform3');
     $form->setView(new Zend_View());
     $output = (string) $form;
     $this->assertNotContains('name="file[]"', $output);
 }
开发者ID:omusico,项目名称:logica,代码行数:18,代码来源:FileTest.php

示例7: advfileAction

 public function advfileAction()
 {
     $this->view->Title = "Manage advertising picture gallery";
     $this->view->headTitle($this->view->Title);
     $dir = ROOT_DIR . DATA_DIR . '/adv';
     if ($this->getRequest()->isPost()) {
         $images = new Zend_Form_Element_File('images');
         $images->setDestination($dir);
         //$element->addValidator ( 'Size', false, 512000 );
         $images->addValidator('Extension', false, 'jpg,png,gif,swf');
         $images->setMultiFile(count($_POST['images']));
         $images->receive();
     }
     if ($this->getRequest()->getParam('delete')) {
         @unlink($dir . '/' . $this->getRequest()->getParam('delete'));
     }
     $this->view->Adv = self::getFileDir($dir);
 }
开发者ID:hoaitn,项目名称:base-zend,代码行数:18,代码来源:SettingsController.php

示例8: testMultiFileInSubSubSubform

 public function testMultiFileInSubSubSubform()
 {
     $form = new Zend_Form();
     $element = new Zend_Form_Element_File('file');
     $element->setMultiFile(2);
     $subform0 = new Zend_Form_SubForm();
     $subform0->addElement($element);
     $subform1 = new Zend_Form_SubForm();
     $subform1->addSubform($subform0, 'subform0');
     $subform2 = new Zend_Form_SubForm();
     $subform2->addSubform($subform1, 'subform1');
     $subform3 = new Zend_Form_SubForm();
     $subform3->addSubform($subform2, 'subform2');
     $form->addSubform($subform3, 'subform3');
     $form->setView(new Zend_View());
     $output = (string) $form;
     $this->assertContains('name="file[]"', $output);
     $this->assertEquals(2, substr_count($output, 'file[]'));
 }
开发者ID:lortnus,项目名称:zf1,代码行数:19,代码来源:FileTest.php


注:本文中的Zend_Form_Element_File::setMultiFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。