I have an upload page script (not created by me). On the upload page a Browse Box appears along with a Submit Button.

Also, the logged-in User Name appears on the page, because of the line of code:
<?php ECHO $account->get_user_name(); ?>

How can I add the functionality where the uploaded file is automatically renamed with the logged-in User's Name (but the uploaded file keeps the same file extension?

On this forum someone directed me to a php Rename example as shown here:
<?php
rename("/tmp/tmp_file.txt", "/home/user/login/docs/my_file.txt");
?>

How can this line of code be modified to capture the User Name and make it the (uploaded) file name?

And then move it to a certain directory?

Someone suggested this line of code:

move_uploaded_file([uploadedfile],[path/to/filename.ext]);

Can someone please provide an example of how I can make all this happen together?

Thank you.