Help with displaying the image link/path

I believe that when a file is selected, this code (below) moves the renamed image file to uploads/

I’d simply like to have the renamed file’s path to display on the same page, after it’s moved.

Can you provide some insight on what’s needed to do that?

if ($form_submitted == 'yes') {
$allowedExts = array("gif", "jpeg", "jpg", "png");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = strtolower( end($temp) );
if ( $_FILES["file"]["size"] < 2000000
&& in_array($extension, $allowedExts) )
{
if ($_FILES["file"]["error"]!= 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
} else {
$length = 20;
$randomString = substr(str_shuffle(md5(time())),0,$length);
$newfilename = $randomString . "." . $extension;
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $newfilename );
$file_location = '<a href="www.--.com/upload/' . $newfilename . '">' . $newfilename . '</a>';
}
} else {
echo "Invalid upload file";
}
$description = $description . " \n " . $newfilename;
}

The html part of this is simply:

<label for="file">Filename:</label>
<input type="file" name="file" id="file">

echo $file_location;

$randomString = substr(str_shuffle(md5(time())),0,$length);
$newfilename = $randomString . "." . $extension;
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $newfilename );

$file_location = '&lt;a href="www.--.com/upload/' . $newfilename . '"&gt;' . $newfilename . '&lt;/a&gt;';
//Probably here.
}

thanks