function file_unmanaged_move

Moves a file to a new location without database changes or hook invocation.

Parameters

$source: A string specifying the filepath or URI of the original file.

$destination: A string containing the destination that $source should be moved to. This must be a stream wrapper URI. If this value is omitted, Drupal's default files scheme will be used, usually "public://".

$replace: Replace behavior when the destination file already exists:

Return value

The URI of the moved file, or FALSE in the event of an error.

See also

file_move()

Related topics

7 calls to file_unmanaged_move()
file_move in drupal/core/modules/file/file.module
Moves a file to a new location and update the file's database entry.
file_unmanaged_save_data in drupal/core/includes/file.inc
Saves a file to the specified destination without invoking file API.
GDToolkit::save in drupal/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/GDToolkit.php
Implements \Drupal\system\Plugin\ImageToolkitInterface::save().
locale_translation_batch_fetch_import in drupal/core/modules/locale/locale.batch.inc
Batch process: Import translation file.
UnmanagedMoveTest::testMissing in drupal/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php
Try to move a missing file.

... See full list

File

drupal/core/includes/file.inc, line 764
API for handling file uploads and server file management.

Code

function file_unmanaged_move($source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
  $filepath = file_unmanaged_copy($source, $destination, $replace);
  if ($filepath == FALSE || file_unmanaged_delete($source) == FALSE) {
    return FALSE;
  }
  return $filepath;
}