當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Form_Element_File::isUploaded方法代碼示例

本文整理匯總了PHP中Zend_Form_Element_File::isUploaded方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Form_Element_File::isUploaded方法的具體用法?PHP Zend_Form_Element_File::isUploaded怎麽用?PHP Zend_Form_Element_File::isUploaded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Form_Element_File的用法示例。


在下文中一共展示了Zend_Form_Element_File::isUploaded方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _processFileElement

 /**
  * Add appropriate validators, filters, and hidden elements for  a file
  * upload element.
  *
  * @param Zend_Form_Element_File $element
  */
 private function _processFileElement($element)
 {
     $element->setDestination(Zend_Registry::get('storage')->getTempDir());
     $options = $this->getThemeOptions();
     $fileName = @$options[$element->getName()];
     if ($fileName) {
         $storage = Zend_Registry::get('storage');
         $fileUri = $storage->getUri($storage->getPathByType($fileName, 'theme_uploads'));
     } else {
         $fileUri = null;
     }
     // Add extension/mimetype filtering.
     if (get_option(File::DISABLE_DEFAULT_VALIDATION_OPTION) != '1') {
         $element->addValidator(new Omeka_Validate_File_Extension(self::$allowedExtensions));
         $element->addValidator(new Omeka_Validate_File_MimeType(self::$allowedMimeTypes));
         $element->addValidator(new Zend_Validate_File_Size(array('max' => self::MAX_UPLOAD_SIZE)));
     }
     // Make sure the file was uploaded before adding the Rename filter to the element
     if ($element->isUploaded()) {
         $this->_addFileRenameFilter($element);
     }
     // add a hidden field to store whether already exists
     $hiddenElement = new Zend_Form_Element_Hidden(self::THEME_FILE_HIDDEN_FIELD_NAME_PREFIX . $element->getName());
     $hiddenElement->setValue($fileUri);
     $hiddenElement->setDecorators(array('ViewHelper', 'Errors'));
     $hiddenElement->setIgnore(true);
     $this->addElement($hiddenElement);
 }
開發者ID:lchen01,項目名稱:STEdwards,代碼行數:34,代碼來源:ThemeConfiguration.php

示例2: testIsUploaded

 public function testIsUploaded()
 {
     $this->element->setTransferAdapter(new Zend_Form_Element_FileTest_MockAdapter());
     $this->assertEquals(true, $this->element->isUploaded());
 }
開發者ID:jsnshrmn,項目名稱:Suma,代碼行數:5,代碼來源:FileTest.php


注:本文中的Zend_Form_Element_File::isUploaded方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。