为什么window.location不重定向页面

I want to back my form upload page after success to upload. alert is run well, but window location is not run.

Here my code. Thanks for help

 if ($uploadKey)
   {
?>
  <script>
          alert("Upload succesfull");
      window.location ('= form_upload.php');
  </script>

        <?php
    }
else{
     ?>
       <script>
           alert("Upload failed");
           window.location('=form_upload.php');
    </script>
<?php
       }

Did you cared to see the syntax? It should be

window.location = "PATH_TO_REDIRECT";

Also, you are using PHP, you should be using header() instead of window.location

if ($uploadKey) {
   header('Location: URL_HERE');
   exit;
}

You have written wrong window.location syntax. Please write as below:

window.location = "form_upload.php";

Instead of :

 window.location ('= form_upload.php');