title: PHP make $_FILES empty
body: <p>I have a form to post text with or without an image.
   When i have uploaded text with an image and after that i only want text to upload 
   without any image,but <code>$_FILES</code> is still filled with the last image i uploaded.
   So my question is how to make <code>$_FILES</code> empty after a image upload.<br>
   I already tried:</p>
  
  <pre><code>  unset($_FILES['file'][0])
  
   but i cant get it empty.
  
  
  
             &lt;?php   
         session_start();
  
          include_once("conf/config.php");
          include_once("twitteroauth/twitteroauth.php");
          echo '&lt;script&gt; function clearform(){ document.getElementById("fileupl").value=" "; }&lt;script&gt;';
         $name = $_POST['txt1'];
         $myfile = $_FILES["fileup"]["name"];
         $connection = new TwitterOAuth($consumer_key,     
         $consumer_secret,$access_token,$accesstoken_secret);
         //print_r($_POST);
         var_dump($_FILES);
         $image = "";
         $errors = "";
  
       if(isset($_FILES["fileup"])){
  
          //echo 'jajajajajaja';
          $account = $connection-&gt;get('account/verify_credentials');
          /* KIJK OF ER EEN FOUT IS OPGETREDEN */
          if($_FILES["fileup"]["error"] &gt; 0){ 
                      echo "Error occured ".$_FILES["fileup"]["error"];  
          }
          /* GEEN FOUT */ 
          $e = $_FILES['fileup']['tmp_name'];
          /* CONTROLEER PHP'S INGEBOUWDE ERROR CHECK VOOR UPLOADEN. */
          if($_FILES['fileup']['error']) echo $errors[$_FILES['file']['error']]; 
          $image = $e;
          /* ALS ER GEEN FOTO GESELECTEERD IS, POST ALLEEN DE TEKST */     
          if($image === "") {
              $paramss = array('status'  =&gt; $name);
              $post= $connection-&gt;post('statuses/update',$paramss);  
              exit();
          } 
          /* ANDERS TEKST MET FOTO */      
          $handle = fopen($image,"r");
          $image     = fread($handle,filesize($image));
          fclose($handle);
          $params = array(
              'media[]' =&gt; "{$image};type={$_FILES['file']['type']};filename={$_FILES['file']['name']}",
              'status'  =&gt; $_POST['txt1'],
              true, // use auth
              true  // multipart
          );
  
   $DataProcessed = $connection-&gt;post('statuses/update_with_media',$params, true);
  
  
  if (isset($DataProcessed) &amp;&amp; $DataProcessed){
  
  $_FILES = array();        $_FILES['file']['name'] = null;
          $_FILES['file']['tmp_name'] = null;
          $_FILES['file']['error'] = null;
          $_FILES['file']['size'] = null;
          echo "data processed";
          var_dump($_FILES);  
  $_POST = array(); // lets pretend nothing was posted        //
  
  
  
  
  // Define the folder to clean
  // (keep trailing slashes)
  $captchaFolder  = 'd:/windows/temp/';
  
  // Filetypes to check (you can also use *.*)
  $fileTypes      = '*.*';
  
  // Here you can define after how many
  // minutes the files should get deleted
  $expire_time    = 1; 
  
  // Find all files of the given file type
  foreach (glob($captchaFolder . $fileTypes) as $Filename) {
  
      // Read file creation time
      $FileCreationTime = filectime($Filename);
  
      // Calculate file age in seconds
      $FileAge = time() - $FileCreationTime; 
  
      // Is the file older than the given time span?
      if ($FileAge &gt; ($expire_time * 6)){
  
          // Now do something with the olders files...
  
          print "The file $Filename is older than $expire_time minutes\n";
  
          // For example deleting files:
          unlink($Filename);
          }
  
          `enter code here`}
  
          exit();
         } 
         } 
  
  
         ?&gt;
         and i use this in my form
   onsubmit="setTimeout(function(){clearform()},3000);"
  </code></pre>
  
  <p>and now it is working correctly thanks for all the help.</p>