# $field->toFiles()

Returns a file collection from a yaml list of filenames in the field

****

- Source: <https://github.com/getkirby/kirby/tree/5.5.3/config/methods.php#L158>

****

```php
$field->toFiles(string $separator = 'yaml'): Kirby\Cms\Files
```

## Parameters

| Name | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| `$separator` | `string` | `'yaml'` | – |

## Return type

`Kirby\Cms\Files`

This method modifies the existing `$field` object it is applied to and returns it again.


## Examples

```php
<?php foreach ($page->gallery()->toFiles() as $image): ?>
  <img src="<?= $image->url() ?>" alt="<?= $image->alt() ?>">
<?php endforeach ?>
```