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


PHP FileManager::move方法代码示例

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


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

示例1: moveFile

 /**
  * Move file to the other path.
  *
  * @access     public
  * @param    string $sPath
  * @return    File
  * @since      2.36.4-dev, 2015-07-03
  * @version    2.37.0-dev, 2015-07-28
  */
 public function moveFile($sPath)
 {
     \FileManager::prepareDir($sPath);
     $oFileManager = new \FileManager();
     $oFileManager->prepareFileByPath($this->getPath() . '/' . $this->getNameWithExt());
     $oFileManager->move($sPath);
     $this->setName($oFileManager->getName());
     // if file name was changed in \FileManager class
     $this->setPath($oFileManager->getPath());
     return $this;
 }
开发者ID:ktrzos,项目名称:plethora,代码行数:20,代码来源:File.php

示例2: Exception

    $list = array_map(function ($item) {
        $date = new \DateTime('now');
        $item['date'] = $date->format('Y-m-d H:i:s');
        return $item;
    }, $list);
    $oResponse->setData($list);
    $oResponse->flushJson();
}
if (Request::getApiParam('mode') === 'editfile') {
    $oResponse->setData($oFtp->getContent(Request::getApiParam('path')));
    $oResponse->flushJson();
}
if (Request::getApiParam('mode') === 'rename') {
    $path = Request::getApiParam('path');
    $newPath = Request::getApiParam('newPath');
    $result = $oFtp->move($path, $newPath);
    if (!$result) {
        throw new Exception("Unknown error renaming this folder");
    }
    $oResponse->setData($result);
    $oResponse->flushJson();
}
if (Request::getApiParam('mode') === 'delete') {
    $path = Request::getApiParam('path');
    $result = $oFtp->delete($path);
    if (!$result) {
        throw new Exception("Unknown error removing this item");
    }
    $oResponse->setData($result);
    $oResponse->flushJson();
}
开发者ID:sagarora77,项目名称:angular-filemanager-1,代码行数:31,代码来源:handler.php

示例3: api_not_allowed

     }
 }
 if (api_is_coach()) {
     if (!DocumentManager::is_visible_by_id($_POST['move_file'], $_course, api_get_session_id(), api_get_user_id())) {
         api_not_allowed();
     }
 }
 $document_to_move = DocumentManager::get_document_data_by_id($_POST['move_file'], api_get_course_id());
 // Security fix: make sure they can't move files that are not in the document table
 if (!empty($document_to_move)) {
     $real_path_target = $base_work_dir . $_POST['move_to'] . '/' . basename($document_to_move['path']);
     $fileExist = false;
     if (file_exists($real_path_target)) {
         $fileExist = true;
     }
     if (FileManager::move($base_work_dir . $document_to_move['path'], $base_work_dir . $_POST['move_to'])) {
         //if (1) {
         //$contents = DocumentManager::replace_urls_inside_content_html_when_moving_file(basename($document_to_move['path']), $base_work_dir.dirname($document_to_move['path']), $base_work_dir.$_POST['move_to']);
         //exit;
         FileManager::update_db_info('update', $document_to_move['path'], $_POST['move_to'] . '/' . basename($document_to_move['path']));
         //update database item property
         $doc_id = $_POST['move_file'];
         if (is_dir($real_path_target)) {
             api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderMoved', api_get_user_id(), $to_group_id, null, null, null, $session_id);
             Display::display_confirmation_message(get_lang('DirMv'));
         } elseif (is_file($real_path_target)) {
             api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentMoved', api_get_user_id(), $to_group_id, null, null, null, $session_id);
             Display::display_confirmation_message(get_lang('DocMv'));
         }
         // Set the current path
         $curdirpath = $_POST['move_to'];
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:document_lite.php

示例4: test_move

 function test_move()
 {
     FileManager::touch('move_test.txt');
     $this->assertTrue(file_exists('files/move_test.txt'));
     $res = FileManager::move('move_test.txt', 'design');
     $this->assertTrue($res);
     $this->assertFalse(file_exists('files/move_test.txt'));
     $this->assertTrue(file_exists('files/design/move_test.txt'));
     $res = FileManager::move('design/move_test.txt', '..');
     $this->assertFalse($res);
     $this->assertEquals('Invalid folder', FileManager::error());
     $res = FileManager::move('design/move_test.txt', '');
     $this->assertTrue($res);
     $this->assertTrue(file_exists('files/move_test.txt'));
     $this->assertFalse(file_exists('files/design/move_test.txt'));
     FileManager::unlink('move_test.txt');
 }
开发者ID:Selwyn-b,项目名称:elefant,代码行数:17,代码来源:FileManagerTest.php

示例5: Exception

    $list = array_map(function ($item) {
        $date = new \DateTime('now');
        $item['date'] = $date->format('Y-m-d H:i:s');
        return $item;
    }, $list);
    $oResponse->setData($list);
    $oResponse->flushJson();
}
if (Request::getApiParam('action') === 'getContent') {
    $oResponse->setData($oFtp->getContent(Request::getApiParam('item')));
    $oResponse->flushJson();
}
if (Request::getApiParam('action') === 'rename') {
    $item = Request::getApiParam('item');
    $newItemPath = Request::getApiParam('newItemPath');
    $result = $oFtp->move($item, $newItemPath);
    if (!$result) {
        throw new Exception("Unknown error renaming this item");
    }
    $oResponse->setData($result);
    $oResponse->flushJson();
}
if (Request::getApiParam('action') === 'move') {
    $items = Request::getApiParam('items');
    $newPath = Request::getApiParam('newPath');
    $errors = array();
    foreach ($items as $item) {
        $fileName = explode('/', $item);
        $fileName = end($fileName);
        $finalPath = $newPath . '/' . $fileName;
        $result = $item ? $oFtp->move($item, $finalPath) : false;
开发者ID:bhupendra-bhudia,项目名称:angular-filemanager,代码行数:31,代码来源:handler.php


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