title: php video file upload and play using videoJS
body: <p>im trying to upload a video file into db and play it with videoJS player.
  Everything ok but the video doesn't work and it shows loading icon and there it stops and the video is not played. does anyone can find out whats wrong? im using video js www.videojs.com</p>
  
  <p>This is the index.php file:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Video Upload System&lt;/title&gt;
  &lt;link rel='stylesheet' href='style.css' /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?php
      include 'connect.php';
  ?&gt;
  
  &lt;div id='box'&gt;
      &lt;form method="post" enctype='multipart/form-data'&gt;
      &lt;?php
          if(isset($_FILES['video'])){
  
  
  
          $name = $_FILES['video']['name'];
          $type = explode('.', $name);
          $type = end($type);
          $size = $_FILES['video']['size'];
          $random_name = rand();
          $tmp = $_FILES['video']['tmp_name'];    
  
          if($type != 'mp4' &amp;&amp; $type != 'MP4' &amp;&amp; $type != 'avi'){
              $message = "Video Format Not Supported";
          }else{
              move_uploaded_file($tmp, 'videos/'.$random_name.'.'.$type);
              mysqli_query($connect, "INSERT INTO cinema VALUES ('','$name','$random_name.$type')");
              $message = "Successfully Uploaded";
          }
  
          echo "$message &lt;br/&gt;&lt;br/&gt;";
  
          }
      ?&gt;
  
          Select Video: &lt;br/&gt;
          &lt;input type='file' name='video' /&gt;
          &lt;br&gt;&lt;br&gt;
          &lt;input type='submit' value='Upload Video'/&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  
  &lt;div id='box'&gt;
  &lt;?php
      $query = mysqli_query($connect, "SELECT id, name, url FROM cinema");
      while ($run = mysqli_fetch_array($query)){
          $video_id = $run['id'];
          $video_name = $run['name'];
          $video_url = $run['url'];
  ?&gt;
      &lt;a href="view.php?video=&lt;?php echo $video_url; ?&gt;"&gt;
      &lt;div id='url'&gt;
          &lt;?php echo $video_name; ?&gt;
      &lt;/div&gt;
      &lt;/a&gt;
  &lt;?php
      }
  ?&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and this is the view.php file:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;title&gt;Video Upload System&lt;/title&gt;
  &lt;link rel='stylesheet' href='style.css' /&gt;
  &lt;link href="http://vjs.zencdn.net/4.2/video-js.css" rel="stylesheet"&gt;
  &lt;script src="http://vjs.zencdn.net/4.2/video.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?php
      include 'connect.php';
  ?&gt;
  
  &lt;div id='box'&gt;
  
  &lt;?php
      $video = $_GET['video'];
  ?&gt;
  &lt;video id="example_video_1" class="video-js vjs-default-skin vjs-big-play-centered"
    controls preload="auto" width="640" height="264"
    poster="http://video-js.zencoder.com/oceans-clip.png"
    data-setup='{"example_option":true}'&gt;
    &lt;source src="&lt;?php echo $video; ?&gt;" type="video/mp4"&gt; 
  &lt;/video&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>