title: PHP success on file upload
body: <p>I'm sure there is a simple solution that I just can't see.</p>
  
  <p>I have a form for uploading stuff.</p>
  
  <p>When the script completes it uses <code>Header('Location: admin.php?success')</code> and a <code>if($_GET['success']) { echo WOOHOO SUCCESS }</code> type message before the rest of the script is run.</p>
  
  <p>The problem with this is that is you want to upload 2 files at once you can't because the first part of the script is executed and nothing else.  I then considered using a boolean value to set true or false and display a message from that but that also failed.  </p>
  
  <p>I'd like to be able to upload several files in succession and receive a success message for each one.</p>
  
  <p>Many thanks.  </p>
  
  <p>relevant PHP:</p>
  
  <pre><code> if(isset($_GET['success']) &amp;&amp; empty($_GET['success'])){
          echo '&lt;h2&gt;File Upload Successful! Whoop!&lt;/h2&gt;';
  
      } else{
  
      if(empty($_POST) === false){
  
          //check that a file has been uploaded
          if(isset($_FILES['myTrainingFile']) &amp;&amp; !empty($_FILES['myTrainingFile']['tmp_name'])){
  
              file stuff...
  
              if(in_array($fileExt, $blacklist) === true){
                  $errors[] = "File type not allowed";
              }
          }
  
          if(empty($errors) === true){
              //run update
              move file stuff...
                  }
  
              }
  
              $comments = htmlentities(trim($_POST['comments']));
              $category = htmlentities(trim($_POST['category']));
  
              $training-&gt;uploadDocument($fileName, $category, $comments);
              header('Location: admin.php?success');
              exit();
  
          } else if (empty($errors) === false) {
              //header('Location: messageUser.php?msg=' .implode($errors));
              echo '&lt;p&gt;' . implode('&lt;/p&gt;&lt;p&gt;', $errors) . '&lt;/p&gt;';
          }}
      }
      ?&gt;
  </code></pre>