function FileSystem::moveUploadedFile
Same name in other branches
- 9 core/lib/Drupal/Core/File/FileSystem.php \Drupal\Core\File\FileSystem::moveUploadedFile()
- 8.9.x core/lib/Drupal/Core/File/FileSystem.php \Drupal\Core\File\FileSystem::moveUploadedFile()
- 10 core/lib/Drupal/Core/File/FileSystem.php \Drupal\Core\File\FileSystem::moveUploadedFile()
Overrides FileSystemInterface::moveUploadedFile
File
-
core/
lib/ Drupal/ Core/ File/ FileSystem.php, line 74
Class
- FileSystem
- Provides helpers to operate on files and stream wrappers.
Namespace
Drupal\Core\FileCode
public function moveUploadedFile($filename, $uri) {
$result = @move_uploaded_file($filename, $uri);
// PHP's move_uploaded_file() does not properly support streams if
// open_basedir is enabled so if the move failed, try finding a real path
// and retry the move operation.
if (!$result) {
if ($realpath = $this->realpath($uri)) {
$result = move_uploaded_file($filename, $realpath);
}
else {
$result = move_uploaded_file($filename, $uri);
}
}
return $result;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.