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


PHP Driver::upload方法代碼示例

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


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

示例1: upload

 /**
  * {@inheritdoc}
  */
 public function upload($fp, $dst, $name, $tmpname)
 {
     $this->setConnectorFromPlugin();
     if ($this->connector->security->isGranted('ROLE_ADMIN')) {
         return parent::upload($fp, $dst, $name, $tmpname);
     }
 }
開發者ID:ragebat,項目名稱:chamilo-lms,代碼行數:10,代碼來源:HomeDriver.php

示例2: upload

 /**
  * {@inheritdoc}
  */
 public function upload($fp, $dst, $name, $tmpname)
 {
     $this->setConnectorFromPlugin();
     if ($this->allow()) {
         return parent::upload($fp, $dst, $name, $tmpname);
     }
 }
開發者ID:omaoibrahim,項目名稱:chamilo-lms,代碼行數:10,代碼來源:HomeDriver.php

示例3: upload

 /**
  * {@inheritdoc}
  */
 public function upload($fp, $dst, $name, $tmpname)
 {
     $this->setConnectorFromPlugin();
     // upload file by elfinder.
     $result = parent::upload($fp, $dst, $name, $tmpname);
     $name = $result['name'];
     $filtered = \URLify::filter($result['name'], 80);
     if (strcmp($name, $filtered) != 0) {
         /*$arg = array('target' => $file['hash'], 'name' => $filtered);
           $elFinder->exec('rename', $arg);*/
         $this->rename($result['hash'], $filtered);
     }
     $realPath = $this->realpath($result['hash']);
     if (!empty($realPath)) {
         // Getting file info
         //$info = $elFinder->exec('file', array('target' => $file['hash']));
         /** @var elFinderVolumeLocalFileSystem $volume */
         //$volume = $info['volume'];
         //$root = $volume->root();
         //var/www/chamilogits/data/courses/NEWONE/document
         $realPathRoot = $this->getCourseDocumentSysPath();
         // Removing course path
         $realPath = str_replace($realPathRoot, '/', $realPath);
         \FileManager::add_document($this->connector->course, $realPath, 'file', intval($result['size']), $result['name']);
     }
     return $result;
 }
開發者ID:ilosada,項目名稱:chamilo-lms-icpna,代碼行數:30,代碼來源:CourseDriver.php

示例4: upload

 /**
  * {@inheritdoc}
  */
 public function upload($fp, $dst, $name, $tmpname)
 {
     $this->setConnectorFromPlugin();
     $sessionId = api_get_session_id();
     if ($this->allow()) {
         // upload file by elfinder.
         $result = parent::upload($fp, $dst, $name, $tmpname);
         $name = $result['name'];
         $filtered = \URLify::filter($result['name'], 80, '', true);
         if (strcmp($name, $filtered) != 0) {
             $result = $this->customRename($result['hash'], $filtered);
         }
         $realPath = $this->realpath($result['hash']);
         if (!empty($realPath)) {
             // Getting file info
             //$info = $elFinder->exec('file', array('target' => $file['hash']));
             /** @var elFinderVolumeLocalFileSystem $volume */
             //$volume = $info['volume'];
             //$root = $volume->root();
             //var/www/chamilogits/data/courses/NEWONE/document
             $realPathRoot = $this->getCourseDocumentSysPath();
             // Removing course path
             $realPath = str_replace($realPathRoot, '/', $realPath);
             $documentId = add_document($this->connector->course, $realPath, 'file', intval($result['size']), $result['name']);
             api_item_property_update($this->connector->course, TOOL_DOCUMENT, $documentId, 'DocumentAdded', api_get_user_id(), null, null, null, null, $sessionId);
         }
         //error_log(print_r($this->error(),1));
         return $result;
     }
     return false;
 }
開發者ID:omaoibrahim,項目名稱:chamilo-lms,代碼行數:34,代碼來源:CourseDriver.php


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