In PHP, what methods or functions can be used to move a file from one directory to another, especially when dealing with user-uploaded content?

When dealing with user-uploaded content in PHP, you may need to move files from one directory to another. This can be done using the `move_uploaded_file()` function, which moves an uploaded file to a new location. It is important to validate and sanitize user input to prevent security vulnerabilities.

$uploadedFile = $_FILES['file']['tmp_name'];
$targetDirectory = 'uploads/';
$targetFile = $targetDirectory . basename($_FILES['file']['name']);

if (move_uploaded_file($uploadedFile, $targetFile)) {
    echo "File moved successfully.";
} else {
    echo "Error moving file.";
}