You are here

function drupal_move_uploaded_file in Drupal 8

Same name and namespace in other branches
  1. 7 includes/file.inc \drupal_move_uploaded_file()

Moves an uploaded file to a new location.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\File\FileSystem::moveUploadedFile().

See also

https://www.drupal.org/node/2418133

Related topics

1 call to drupal_move_uploaded_file()
FileSystemDeprecationTest::testDeprecatedFileMoveUploadedFile in core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php
@expectedDeprecation drupal_move_uploaded_file() is deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::moveUploadedFile(). See https://www.drupal.org/node/2418133.

File

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

Code

function drupal_move_uploaded_file($filename, $uri) {
  @trigger_error('drupal_move_uploaded_file() is deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\File\\FileSystemInterface::moveUploadedFile(). See https://www.drupal.org/node/2418133.', E_USER_DEPRECATED);
  return \Drupal::service('file_system')
    ->moveUploadedFile($filename, $uri);
}