title: Upload JSON file error
body: <p>I want to ulpload JSON and txt files to the server with a size of 200KB.</p>
  
  <p>This is the script I'm using:</p>
  
  <pre><code>$allowedExts = array("json", "txt");
  $temp = explode(".", $_FILES["file"]["name"]);
  $extension = end($temp);
  
  if ((($_FILES["file"]["type"] == "application/json")
          || ($_FILES["file"]["type"] == "text/txt"))
      &amp;&amp; ($_FILES["file"]["size"] &lt; 200000)
      &amp;&amp; in_array($extension, $allowedExts)
  ) {
      if ($_FILES["file"]["error"] &gt; 0) {
          echo "Código do erro: " . $_FILES["file"]["error"] . "&lt;br&gt;";
      } else {
          echo "Upload: " . $_FILES["file"]["name"] . "&lt;br&gt;";
          echo "Type: " . $_FILES["file"]["type"] . "&lt;br&gt;";
          echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB&lt;br&gt;";
          echo "Temp file: " . $_FILES["file"]["tmp_name"] . "&lt;br&gt;";
          move_uploaded_file($_FILES["file"]["tmp_name"],
              "upload" . $_FILES["file"]["name"]);
          echo "Gravado em: " . $diretorio . $_FILES["file"]["name"];
      }
  } else {
      echo "Invalid file.";
  }
  </code></pre>
  
  <p>But I always get the "Invalid file" error. Why is it?</p>