<?php require_once dirname(__FILE__) . "/../../admin/synch-setup.php"; echo __FILE__ . ' $post = <br /><pre>' . print_r($_POST, true) . '</pre></br>'; echo __FILE__ . ' $_FILES = <br /><pre>' . print_r($_FILES, true) . '</pre></br>'; /* * Save the file to disk */ //FileSystem::putFileContents(); //'destination/temp.txt' FileSystem::moveFile($_FILES['file1']['tmp_name'], 'destination/' . $_FILES['file1']['name']);
public function moveBackupFromQueueToSession($session, $fileName, $type = 0) { if (!isset($session) || empty($fileName)) { return false; } $pathFrom = $this->createQueueSessionPath($session->id, $type); // Check the queue for a session folder. If there is one copy any zip // files inside to the session backups folders $pathFrom .= '/' . $fileName; if (!FileSystem::exists($pathFrom, 'f')) { return false; } $pathTo = $this->createSessionBackupPath($session); $pathTo .= '/' . $fileName; FileSystem::createFoldersFromPath(FileSystem::path_pop($pathTo)); FileSystem::moveFile($pathFrom, $pathTo); return true; }
<?php /* * * @copyright © 2007 The Open University * @author c.chambers@open.ac.uk * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package synch * * This file is used to transfer a file from the temporary download location * into the moodle synch queue. */ require_once dirname(__FILE__) . "/setup.php"; global $CFG; // Get the path of the temporary file $from = $_FILES['file1']['tmp_name']; $path = $CFG->synch->path_queue_in; // If the file is attached to a session save it in a session folder if (isset($_POST['sessionId'])) { $path .= '/' . $_POST['sessionId']; } // Create the path to move the file to $to = $path . '/' . $_FILES['file1']['name']; // Create folders if they aren't already there FileSystem::createFoldersFromPath($path); FileSystem::moveFile($from, $to);