apps/files_external/3rdparty/icewind/smb/src/Share.php
/**
	 * Open a writable stream to a remote file
	 *
	 * @param string $target
	 * @return resource a write only stream to upload a remote file
	 *
	 * @throws \Icewind\SMB\Exception\NotFoundException
	 * @throws \Icewind\SMB\Exception\InvalidTypeException
	 */
Open a writable stream to a remote file
@param string $target
@return resource a write only stream to upload a remote file


Open a writable stream to a remote file @param string $target @return resource a write only stream to upload a remote file
public function write($target) {
		$target = $this->escapePath($target);
		$connection = $this->getConnection();
		$fh = $connection->getFileInputStream();
		$connection->write('put ' . System::getFD(4) . ' ' . $target);
		$connection->write('exit');
		return CallbackWrapper::wrap($fh, null, null, function () use ($connection, $target) {
			$connection->close(false); 
		});
	}
public function write ( $ target ) { $ target = $ this -> escapePath ( $ target ) ; $ connection = $ this -> getConnection ( ) ; $ fh = $ connection -> getFileInputStream ( ) ; $ connection -> write ( 'put ' . System :: getFD ( 4 ) . ' ' . $ target ) ; $ connection -> write ( 'exit' ) ; return CallbackWrapper :: wrap ( $ fh , null , null , function ( ) use ( $ connection , $ target ) { $ connection -> close ( false ) ; } ) ; }
Open a writable stream to a remote file
 @param string $target
 @return resource a write only stream to upload a remote file
Open a writable stream to a remote file @param string $target @return resource a write only stream to upload a remote file
// 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 // use a close callback to ensure the upload is finished before continuing // this also serves as a way to keep the connection in scope // dont terminate, give the upload some time