Moves a file to a new location without database changes or hook invocation.
$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:
The URI of the moved file, or FALSE in the event of an error.
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;
}