Move a file in drupal 8 | Drupal 8

Move a file in drupal 8

Submitted by editor on Thu, 12/17/2015 - 19:24

file_move(FileInterface $source, $destination = NULL, $replace = FILE_EXISTS_RENAME)

Example:

$file = \Drupal\file\Entity\File::load($fid);
file_move(FileInterface $source, 'path/to/destination');

https://api.drupal.org/api/drupal/core!modules!file!file.module/function/file_move/8

Tags

Comments

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.