本文整理汇总了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());
}