putFile() public méthode

Saves file contents to a remote file.
public putFile ( string $path, string $file )
$path string File path
$file string Local file path
Exemple #1
0
 /**
  * Tests uploading a file.
  *
  * @depends testMkdir
  */
 public function testPutFile()
 {
     if (empty($GLOBALS['tmp'])) {
         $this->markTestSkipped('Temp dir not set');
     }
     // Create a temporary file
     $file = $GLOBALS['tmp'] . '/testfile.txt';
     file_put_contents($file, 'test');
     // Uploading
     $this->assertTrue($this->client->putFile($this->dir . '/testfile.txt', $file));
     $this->assertTrue($this->client->exists($this->dir . '/testfile.txt'));
     // Delete the temporary file
     @unlink($file);
 }