Jyxo\Webdav\Client::putFile PHP Method

putFile() public method

Saves file contents to a remote file.
public putFile ( string $path, string $file )
$path string File path
$file string Local file path
    public function putFile(string $path, string $file)
    {
        $this->processPut($this->getFilePath($path), $file, true);
    }

Usage Example

Example #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);
 }