New file name in a session variable. Is this correct?

In an Upload Form that I’m using, it has this line:
$newfilename = $_SESSION['user_id'].$_FILES["file"]["name"];

I need to “store the newfilename in a session variable”
(in another php file)
and use the session variable in this link, instead of newfilename,

<a href="upload/<?php echo $newfilename?>"><?php echo $newfilename?></a>

So, would this be correct?

$newfilename = $_SESSION['newfilename'].$_FILES["newfilename"];

no. $_FILES['newfilename'] is an array which contains several metadata about the uploaded file.

just go for the obvious one.

// save file name
$_SESSION['newfilename'] = $newfilename;

PS. unescaped _ is used in markdown for italic style, therefore you need to wrap your inline code in single backticks.