title: $_FILES is not set
body: <p>I am trying to create a script to upload a .mp3 file, and insert the filename into a database. Anytime that I try to submit the form, I get the error <code>The FILES global variable was not set</code>, which is a error that I specified, telling me that <code>$_FILES</code> is not set.</p>
  
  <pre><code>if(empty($_POST['postTitle'])){
    $error[] = "Please enter a title.";
  }
  if(empty($_POST['image'])) {
    $error[] = "Please select a file.";
  }
  if(empty($_POST['postAudio'])) {
    $error[] = "Please enter some text";
  }
  
  $allowedExts = array("jpg", "jpeg", "gif", "png", "mp3", "mp4", "wma"); // Universal between the image and audio
  
  if(isset($_FILES['image'])){
    $imageName = $_FILES['image']['name'];
    $extension = substr($imageName, strrpos($imageName, '.') + 1);
  
    if(in_array($extension, $allowedExts)) {
    if($_FILES['image']['error'] &gt; 0) {
      echo "Return Code: " . $_FILES['image']['error'] . "&lt;br /&gt;";
    } else {
      echo "Upload: " . $_FILES['image']['name'] . "&lt;br /&gt;";
      echo "Type: " . $_FILES['image']['type'] . "&lt;br /&gt;";
      echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb&lt;br /&gt;";
      echo "Temp file: " . $_FILES["file"]["tmp_name"] . "&lt;br /&gt;";
  
      if (file_exists("upload/" . $_FILES["file"]["name"])) {
        echo $_FILES["file"]["name"] . " already exists. ";
      } else {
        move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $_FILES["file"]["name"]);
        echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
       }
     }
    }
  else
                  {
                  $error[] = "There was an error trying to get information about one of your uploads.";
                  }
              } else {
                  $error[] = "The FILES global variable was not set.";
              }
  
              if(!isset($error)){
                  try {
  
                      $query = "INSERT INTO blog_podcasts (postTitle,postImage,postAudio,postDate) VALUES (:postTitle, :postImage, :postAudio, :postDate)";
                      $query_params = array(
                          ':postTitle' =&gt; $_POST['postTitle'],
                          ':postImage' =&gt; $imageName,
                          ':postAudio' =&gt; $_POST['postAudio'],
                          ':postDate' =&gt; date('Y-m-d H:i:s')
                          );
                      $stmt = $db-&gt;prepare($query);
                      $result = $stmt-&gt;execute($query_params);
                  } catch(PDOException $e) {
                      echo $e-&gt;getMessage();
                  }
                      header('Location: index.php?action=added');
                      exit;
              }
          }
          ?&gt;
          &lt;?php
          //check for any errors
              if(isset($error)){
                  foreach($error as $error){
                      echo '&lt;p class="error"&gt;'.$error.'&lt;/p&gt;';
                  }
              }
          ?&gt;
          &lt;form action='' method='post'&gt;
  
              &lt;p&gt;&lt;label&gt;Title&lt;/label&gt;&lt;br /&gt;
              &lt;input type='text' name='postTitle' value='&lt;?php if(isset($error)){ echo $_POST['postTitle'];}?&gt;'&gt;&lt;/p&gt;
  
              &lt;p&gt;&lt;label for="file"&gt;&lt;span&gt;Filename: &lt;/span&gt;&lt;/label&gt;
              &lt;input type="file" name="image" id="file" /&gt;
  
              &lt;p&gt;&lt;label&gt;Audio:&lt;br /&gt;
              &lt;input type="text" name="postAudio" /&gt;&lt;/p&gt;
  
  
  
              &lt;p&gt;&lt;input type='submit' name='submit' value='Submit'&gt;&lt;/p&gt;
          &lt;/form&gt;
  </code></pre>