title: Uploading mp4 files using PHP
body: <p>I am able to upload png/jpegs/images using PHP upload script but am not able to upload mp4 files on my local server. Script is not displaying any error.</p>
  
  <pre><code>&lt;?php
  ini_set('display_startup_errors',1);
  ini_set('display_errors',1);
  error_reporting(-1);
  //include authentication here/ Gmail is good solution for now
  //check if it's not allowing any other extenstion other than MP4
  $allowedExts = array("gif", "jpeg", "jpg", "png","mp4");
  $temp = explode(".", $_FILES["file"]["name"]);
  print_r($_FILES["file"]["type"]);
  $extension = end($temp);
  if ((($_FILES["file"]["type"] == "image/gif")
  || ($_FILES["file"]["type"] == "image/jpeg")
  || ($_FILES["file"]["type"] == "image/jpg")
  || ($_FILES["file"]["type"] == "image/pjpeg")
  || ($_FILES["file"]["type"] == "image/x-png")
  || ($_FILES["file"]["type"] == "image/png"))
  || ($_FILES["file"]["type"] == "video/mp4"))
  &amp;&amp; ($_FILES["file"]["size"] &lt; 200000)
  &amp;&amp; in_array($extension, $allowedExts)) {
    if ($_FILES["file"]["error"] &gt; 0) {
      echo "Return Code: " . $_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;";
      if (file_exists("uploads/" . $_FILES["file"]["name"])) {
        echo $_FILES["file"]["name"] . " already exists. ";
      } else {
        move_uploaded_file($_FILES["file"]["tmp_name"],
        "uploads/" . $_FILES["file"]["name"]);
        echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
      }
    }
  } else {
    echo "Invalid file";
  }
  ?&gt;
  enter code here
  changed my code to this
  
  
   &lt;?php
      ini_set('display_startup_errors',1);
      ini_set('display_errors',1);
      error_reporting(-1);
      //include authentication here/ Gmail is good solution for now
      //check if it's not allowing any other extenstion other than MP4
      $allowedExts = array("gif", "jpeg", "jpg", "png","mp4");
      $temp = explode(".", $_FILES["file"]["name"]);
      print_r($_FILES["file"]["type"]);
      $extension = end($temp);
      if (($_FILES["file"]["size"] &lt; 200000)) {
        if ($_FILES["file"]["error"] &gt; 0) {
          echo "Return Code: " . $_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;";
          if (file_exists("uploads/" . $_FILES["file"]["name"])) {
            echo $_FILES["file"]["name"] . " already exists. ";
          } else {
            move_uploaded_file($_FILES["file"]["tmp_name"],
            "uploads/" . $_FILES["file"]["name"]);
            echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
          }
        }
      } else {
        echo "Invalid file";
      }
      ?&gt;
  </code></pre>
  
  <p>still same error</p>
  
  <blockquote>
    <p>video/mp4Invalid file</p>
  </blockquote>