public function getPermittedFileName($directory, $filename) {

        /**
         * Get $pathInfo from $filename
         */
        $pathInfo = pathinfo($filename);

        /**
         * Max limit permitted $filename
         */
        $pathInfo['filename'] = substr(Inflector::slug($pathInfo['filename']), 0, 100);

        /**
         * Min limit permitted $filename
         */
        if (strlen($pathInfo['filename']) < 3)
            $pathInfo['filename'] = $this->_randomString();

        /**
         * 
         */
        $dir = new Folder($directory);
        $iter = 0;
        do {
            if ($iter == 0)
                $slugFileName = $pathInfo['filename'] . '.' . $pathInfo['extension'];
            else
                $slugFileName = $pathInfo['filename'] . '-' . $iter . '.' . $pathInfo['extension'];
            $data = $dir->find($slugFileName, true);
            $iter++;
        } while (count($data) > 0);

        return $slugFileName;
    }
public function getPermittedFileName($directory, $filename) {

        /**
         * Get $pathInfo from $filename
         */
        $pathInfo = pathinfo($filename);

        /**
         * Max limit permitted $filename
         */
        $pathInfo['filename'] = substr(Inflector::slug($pathInfo['filename']), 0, 100);

        /**
         * Min limit permitted $filename
         */
        if (strlen($pathInfo['filename']) < 3)
            $pathInfo['filename'] = $this->_randomString();

        /**
         * 
         */
        $dir = new Folder($directory);
        $iter = 0;
        do {
            if ($iter == 0)
                $slugFileName = $pathInfo['filename'] . '.' . $pathInfo['extension'];
            else
                $slugFileName = $pathInfo['filename'] . '-' . $iter . '.' . $pathInfo['extension'];
            $data = $dir->find($slugFileName, true);
            $iter++;
        } while (count($data) > 0);

        return $slugFileName;
    }
public function getPermittedFileName ( $ directory , $ filename ) { /**
         * Get $pathInfo from $filename
         */ $ pathInfo = pathinfo ( $ filename ) ; /**
         * Max limit permitted $filename
         */ $ pathInfo [ 'filename' ] = substr ( Inflector :: slug ( $ pathInfo [ 'filename' ] ) , 0 , 100 ) ; /**
         * Min limit permitted $filename
         */ if ( strlen ( $ pathInfo [ 'filename' ] ) < 3 ) $ pathInfo [ 'filename' ] = $ this -> _randomString ( ) ; /**
         * 
         */ $ dir = new Folder ( $ directory ) ; $ iter = 0 ; do { if ( $ iter == 0 ) $ slugFileName = $ pathInfo [ 'filename' ] . '.' . $ pathInfo [ 'extension' ] ; else $ slugFileName = $ pathInfo [ 'filename' ] . '-' . $ iter . '.' . $ pathInfo [ 'extension' ] ; $ data = $ dir -> find ( $ slugFileName , true ) ; $ iter ++ ; } while ( count ( $ data ) > 0 ) ; return $ slugFileName ; }
Returns the valid file name to use for upload

@param string $path
@return string
Returns the valid file name to use for upload