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;
    }
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;
    }
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 ; }
Crypt filename and concat with folder

@param string $name   Name Original, Return Referer
@param string $folder Remote Folder

@return string
@throws
Crypt filename and concat with folder