public function copyToPublic($path, $overwrite = false)
    {
        $publicPath = realpath($this->getPublicPath());
        $targetFilePath   = $publicPath.DIRECTORY_SEPARATOR.basename($path);
        
        if (($overwrite === true && file_exists($targetFilePath)) || !file_exists($targetFilePath)) {
            if (!copy($path, $targetFilePath)) {
                throw new \RuntimeException("Cannot copy ".basename($path)." to ".$publicPath);
            }
        }
        
        return $targetFilePath;
    }
public function copyToPublic($path, $overwrite = false)
    {
        $publicPath = realpath($this->getPublicPath());
        $targetFilePath   = $publicPath.DIRECTORY_SEPARATOR.basename($path);
        
        if (($overwrite === true && file_exists($targetFilePath)) || !file_exists($targetFilePath)) {
            if (!copy($path, $targetFilePath)) {
                throw new \RuntimeException("Cannot copy ".basename($path)." to ".$publicPath);
            }
        }
        
        return $targetFilePath;
    }
public function copyToPublic ( $ path , $ overwrite = false ) { $ publicPath = realpath ( $ this -> getPublicPath ( ) ) ; $ targetFilePath = $ publicPath . DIRECTORY_SEPARATOR . basename ( $ path ) ; if ( ( $ overwrite === true && file_exists ( $ targetFilePath ) ) || ! file_exists ( $ targetFilePath ) ) { if ( ! copy ( $ path , $ targetFilePath ) ) { throw new \ RuntimeException ( "Cannot copy " . basename ( $ path ) . " to " . $ publicPath ) ; } } return $ targetFilePath ; }
Copy given file to publicSchemaPath

@param string  $path      Path to file
@param boolean $overwrite Overwrite file if it exists? default false

@return string Path to new file
@throws RuntimeException If file cannot be copied
Copy given file to publicSchemaPath