yii\mongodb\file\Download::toFile PHP Method

toFile() public method

Saves download to the physical file.
public toFile ( string $filename ) : integer
$filename string name of the physical file.
return integer number of written bytes.
    public function toFile($filename)
    {
        $filename = Yii::getAlias($filename);
        FileHelper::createDirectory(dirname($filename));
        return $this->toStream(fopen($filename, 'w+'));
    }