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


PHP Zend_File_Transfer_Adapter_Http::isFiltered方法代码示例

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


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

示例1: uploadFileToTempFolderForUser

 /**
  * Uploads the specified file found in $upload for the specified user
  * to the temp folder.
  * As of know, only one file per upload is permitted.
  * make sure the upload has been filtered and validated before passing it
  * to this method
  *
  * @param Zend_File_Transfer_Adapter_Http $upload
  * @param int $userId
  *
  * @return null if an error occured or Conjoon_Groupware_Files_File_Dto
  *
  * @throws InvalidArgumentException
  * @throws Conjoon_Modules_Groupware_Files_Exception
  */
 public function uploadFileToTempFolderForUser(Zend_File_Transfer_Adapter_Http $upload, $userId)
 {
     $this->_checkArguments(array('userId' => array('value' => &$userId, 'type' => 'int')));
     if (count($upload->getFilters()) && !$upload->isFiltered()) {
         /**
          * @see Conjoon_Modules_Groupware_Files_Exception
          */
         require_once 'Conjoon/Modules/Groupware/Files/Exception.php';
         throw new Conjoon_Modules_Groupware_Files_Exception("The upload has not been filtered yet.");
     }
     if (!$upload->isValid()) {
         /**
          * @see Conjoon_Modules_Groupware_Files_Exception
          */
         require_once 'Conjoon/Modules/Groupware/Files/Exception.php';
         throw new Conjoon_Modules_Groupware_Files_Exception("The upload has not been validated yet.");
     }
     // check if only one file is available
     if (count(array_keys($upload->getFileInfo())) != 1) {
         throw new Conjoon_Modules_Groupware_Files_Exception("Only one file per download permitted.");
     }
     $fileInfo = array_pop($upload->getFileInfo());
     $name = $fileInfo['name'];
     $path = $fileInfo['tmp_name'];
     $type = $fileInfo['type'];
     $tmpFolderId = $this->_getFolderFacade()->getTempFolderIdForUser($userId);
     $obj = $this->_getFileFacade()->moveFileToFolderForUserId($path, $tmpFolderId, $userId, $name, $type);
     if (!$obj) {
         return null;
     }
     return $obj->getDto();
 }
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:47,代码来源:Facade.php


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