本文整理匯總了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);
}
示例2: testIsUploaded
public function testIsUploaded()
{
$this->element->setTransferAdapter(new Zend_Form_Element_FileTest_MockAdapter());
$this->assertEquals(true, $this->element->isUploaded());
}