Exemple #1
0
 /**
  * Upload a local file
  *
  * @param string $source local file
  * @param string $target remove file
  * @return bool
  *
  * @throws \SMBBundle\SMB\Exception\NotFoundException
  * @throws \SMBBundle\SMB\Exception\InvalidTypeException
  */
 public function put($source, $target)
 {
     $this->connect();
     $sourceHandle = fopen($source, 'rb');
     $targetHandle = $this->state->create($this->buildUrl($target));
     while ($data = fread($sourceHandle, 4096)) {
         $this->state->write($targetHandle, $data);
     }
     $this->state->close($targetHandle);
     return true;
 }
Exemple #2
0
 public function stream_write($data)
 {
     return $this->state->write($this->handle, $data);
 }