yii\mongodb\file\Upload::addContent PHP Method

addContent() public method

This method can invoked several times before Upload::complete is called.
public addContent ( string $content )
$content string binary content.
    public function addContent($content)
    {
        $freeBufferLength = $this->chunkSize - StringHelper::byteLength($this->buffer);
        $contentLength = StringHelper::byteLength($content);
        if ($contentLength > $freeBufferLength) {
            $this->buffer .= StringHelper::byteSubstr($content, 0, $freeBufferLength);
            $this->flushBuffer(true);
            return $this->addContent(StringHelper::byteSubstr($content, $freeBufferLength));
        } else {
            $this->buffer .= $content;
            $this->flushBuffer();
        }
        return $this;
    }