protected function setFilename(&$name, $folder, $override = false)
    {
        $folder = trim($folder, '/');
        $extension = strrchr($name, '.');
        $len = mb_strlen($name) - mb_strlen($extension);
        $nameOrig = substr($name,0,$len);
        $num = 0;
        do {
            if (!$override && $num > 0) {
                $name = "{$nameOrig}-{$num}{$extension}";
            }
            $num++;

            $filename  = "/{$folder}/{$name}";
        } while ($this->storage->exists($filename));

        return $filename;
    }