mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-04 09:44:08 +02:00
optional truncate
This commit is contained in:
parent
e6c7a6763b
commit
7e49f35ae3
2 changed files with 17 additions and 4 deletions
|
|
@ -326,12 +326,18 @@ class Share extends AbstractShare {
|
|||
* Open a writable stream to a remote file
|
||||
*
|
||||
* @param string $target
|
||||
* @param bool $truncate
|
||||
* @return resource a write only stream to upload a remote file
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\DependencyException
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
*/
|
||||
public function write($target) {
|
||||
public function write($target, $truncate=true) {
|
||||
if($truncate === false) {
|
||||
throw new DependencyException('truncate required by smbclient, use php-libsmbclient instead');
|
||||
}
|
||||
|
||||
$target = $this->escapePath($target);
|
||||
// since returned stream is closed by the caller we need to create a new instance
|
||||
// since we can't re-use the same file descriptor over multiple calls
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue