$file->delete()

Deletes the file. This cannot be undone.

  • return (boolean)

Example

$file = $page->file('old-file.pdf');

try {

  $file->delete();
  echo 'The file has been deleted';

} catch(Exception $e) {

  echo 'The file could not be deleted';
  // optional reason: echo $e->getMessage();

}

Is something missing or incorrect? Edit this page on Github…