title: video upload in php
body: <p>I am trying a demo for video upload in php but i am getting error as</p>
  
  <blockquote>
    <p>Notice: Undefined index: file in C:\wamp\www\upp\upload_file.php on line 3
    Call Stack</p>
  </blockquote>
  
  <p>files are as follows:</p>
  
  <p>abcd.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;form action="upload_file.php" method="post"
  enctype="multipart/form-data"&gt;
  &lt;label for="file"&gt;Filename:&lt;/label&gt;
  &lt;input type="file" name="file" id="file"&gt;&lt;br&gt;
  &lt;input type="submit" name="submit" value="Submit"&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>upload_file.php</p>
  
  <pre><code>&lt;?php
  $allowedExts = array("wmv","avi","mpeg","mpg");
  $extension = end(explode(".", $_FILES["file"]["name"]));
  if ((($_FILES["file"]["type"] == "video/avi")|| ($_FILES["file"]["type"] == "video/mpeg")
  || ($_FILES["file"]["type"] == "video/wmv")
  || ($_FILES["file"]["type"] == "video/mpg"))
  &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("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
    {
    echo "Invalid file";
    }
  ?&gt;
  
  enter code here
  </code></pre>
  
  <p>when i tried for image upload it works but for uploading video i changed file type in php code so it gives the above error</p>