Uploaded Video not played in browser in php

i am building one website.where i want user to upload there video and play whenever they want.

i am able to upload video. but when i am want to play that or any (other video) also its not playing in browser. i know some where i am going wrong but can not finding the issue.

Here my code for upload video:

<form action="video.php" method="post"  enctype="multipart/form-data">
<span> Add Video's here</span>
<p>
    <label>Give a caption to the video</label>
    <input type="text"  name="caption" title="caption">
</p>
         <input type="file" name="file" id="files" value="Upload Photo" style="border:0">
        <input type="submit" name="Upload" id="uploadph" value="Upload video">


</form>

PHP code video.php:

$allowedExts = array("avi","wmv","mp4");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
$filename=$_FILES["file"]["name"];
$filepath=$path.$filename;
echo $filepath; 

if (($_FILES["file"]["type"] == "video/x-ms-wmv")
||($_FILES["file"]["type"] == "video/avi")
|| ($_FILES["file"]["type"] == "video/mp4")
&& in_array($extension, $allowedExts))
  {
   echo"1";
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
   echo"sdfsd";
    }
  else
    { 
       echo"2";
       move_uploaded_file($_FILES["file"]["tmp_name"],
      "uploads/".$filename);
       echo "Stored in: " . "upload/" . $_FILES["file"]["name"];

    }

It is uploading in upload folder. when i want to play this it not playing.

Code to play video:

<html>
<body>
<video width="320" height="240" controls="true" scale="aspect"><source src="upload/test.avi" height="100" width="100"></video>

</body>
</html>

please can any one help me on this.

thank you.


Solution 1:

<!-- BEGIN GENERIC ALL BROWSER FRIENDLY HTML FOR WINDOWS MEDIA PLAYER -->

<object id="MediaPlayer1" width="150" height="170"
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft® Windows® Media Player components..."
type="application/x-oleobject" align="middle">
<param name="FileName" value="test.avi">
<param name="ShowStatusBar" value="True">
<param name="DefaultFrame" value="mainFrame">
<param name="autostart" value="false">
<embed type="application/x-mplayer2"
pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/"
src="upload/test.avi"
autostart="false"
align="middle"
width="150"
height="170"
defaultframe="rightFrame"
showstatusbar="true">
</embed>
</object>