$file->update($data = array()[, $language])

Updates the meta information for a file

  • $data (array)
  • $language (string)
    Language code
  • return ($file)


$file = $page->file('myimage.jpg');

try {

    'caption' => 'This is a really nice image',
    'year'    => 2014

  echo 'The meta info has been updated';

} catch(Exception $e) {

  echo 'The meta info could not be updated';
  // optional reason: echo $e->getMessage();


Multi-language installation

In a multi-language installation, you can pass the language of the meta data you want to update as a second argument:

  'some_field' => 'new value'
), 'en');

  'some_field' => 'new value'
), site()->language()->code());