示例#1
0
        //$filePath = "D:\\Program Files\\Apache\\htdocs\\test.txt";
        //$filePath = 'C:\\projects\\VLE\\Mobile Moodle\\htdocs\\development\\client-1.9\\synch\\_development\\20070831\\test.txt';
        //$filePath = 'source/test.txt';
        //$filePath = realpath('source/test.txt');
        $filePath = realpath('source/backup-cf101-20070806-1529.zip');
        //$filePath = realpath('source/Mobile Moodle Demonstration Version 1.zip');
        $Out->append("{$filePath} = " . $filePath);
        $Out->flush();
        //$domain = 'localhost';
        $domain = 'pclt1048.open.ac.uk';
        $instance = 'client-1.9';
        //$instance = 'server-1.9';
        $url = 'http://' . $domain . '/offline/development/' . $instance . '/synch/_development/20070831/fileUploaderTest.php';
        //$url = 'http://cc5983.vledev.open.ac.uk/offline/development/20070903/fileUploaderTest.php';
        $objCurlFileUploader = new CurlFileUploader($filePath, $url, 'file1');
        $objCurlFileUploader->UploadFile();
        // upload file with some post params
        /*
        $objCurlFileUploader = new CurlFileUploader("D:\\Program Files\\Apache\\htdocs\\test.txt", "http://localhost/fileUploaderTest.php",'file1', Array('test' => 'test1'));
        $objCurlFileUploader->UploadFile();
        */
        break;
}
$Out->flush();
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
	<head>
		<title>Moodle cUrl test client</title>
	</head>
	<body>
	    <p>
示例#2
0
 public function uploadFileToRemoteHost($path, $url, $deleteFile = true)
 {
     global $SynchSessionController;
     $sessionId = $SynchSessionController->getCurrentSessionId();
     $fileUploader = new CurlFileUploader($path, $url, 'file1', array('sessionId' => $sessionId));
     $fileUploader->UploadFile();
     if ($deleteFile) {
         FileSystem::deleteFile($path);
     }
     return true;
 }