protected function getValidFilename($tmpFile, $folderPath = null)
    {
        if (!is_array($tmpFile)) {
            throw new InvalidArgumentException(
                "Upload::load() Not passed an array.  Most likely, the form hasn't got the right enctype"
            );
        }

        // Validate
        $this->clearErrors();
        $valid = $this->validate($tmpFile);
        if (!$valid) {
            return false;
        }

        // Clean filename
        if (!$folderPath) {
            $folderPath = $this->config()->uploads_folder;
        }
        $nameFilter = FileNameFilter::create();
        $file = $nameFilter->filter($tmpFile['name']);
        $filename = basename($file);
        if ($folderPath) {
            $filename = File::join_paths($folderPath, $filename);
        }
        return $filename;
    }
protected function getValidFilename($tmpFile, $folderPath = null)
    {
        if (!is_array($tmpFile)) {
            throw new InvalidArgumentException(
                "Upload::load() Not passed an array.  Most likely, the form hasn't got the right enctype"
            );
        }

        // Validate
        $this->clearErrors();
        $valid = $this->validate($tmpFile);
        if (!$valid) {
            return false;
        }

        // Clean filename
        if (!$folderPath) {
            $folderPath = $this->config()->uploads_folder;
        }
        $nameFilter = FileNameFilter::create();
        $file = $nameFilter->filter($tmpFile['name']);
        $filename = basename($file);
        if ($folderPath) {
            $filename = File::join_paths($folderPath, $filename);
        }
        return $filename;
    }
protected function getValidFilename ( $ tmpFile , $ folderPath = null ) { if ( ! is_array ( $ tmpFile ) ) { throw new InvalidArgumentException ( "Upload::load() Not passed an array.  Most likely, the form hasn't got the right enctype" ) ; } // Validate $ this -> clearErrors ( ) ; $ valid = $ this -> validate ( $ tmpFile ) ; if ( ! $ valid ) { return false ; } // Clean filename if ( ! $ folderPath ) { $ folderPath = $ this -> config ( ) -> uploads_folder ; } $ nameFilter = FileNameFilter :: create ( ) ; $ file = $ nameFilter -> filter ( $ tmpFile [ 'name' ] ) ; $ filename = basename ( $ file ) ; if ( $ folderPath ) { $ filename = File :: join_paths ( $ folderPath , $ filename ) ; } return $ filename ; }
Given a temporary file and upload path, validate the file and determine the
value of the 'Filename' tuple that should be used to store this asset.

@param array $tmpFile
@param string $folderPath
@return string|false Value of filename tuple, or false if invalid
Given a temporary file and upload path validate the file and determine the value of the Filename tuple that should be used to store this asset .