just use
header("Location: upload.html");
exit;
If you use this, nothing can have been outputted to the browser first.
You can do as much PHP coding before the header command, but NO BROWSER OUTPUT.
So you would get rid of the HTML at the top of the script.
If you have to output html as part of this script just use a javascript re-direct, something like,
<script language="Javascript">
window.location.url = 'upload.html'
or
window.location.href= 'upload.html'
</script>
// i can never remember which of the 2 is the correct way.
Jamie