How can file permissions be set in PHP after uploading a file?

After uploading a file in PHP, you can set file permissions using the `chmod()` function. This function allows you to specify the desired permissions for the file, such as read, write, and execute permissions for the owner, group, and others.

$file = 'path/to/uploaded/file.txt';
$permissions = 0644; // Example permission setting - read/write for owner, read for group and others

if (file_exists($file)) {
    chmod($file, $permissions);
    echo 'File permissions set successfully.';
} else {
    echo 'File does not exist.';
}