title: Uploading a video using Jquery and Ajax/Json
body: <p>What do I need to add to my code here to add the ability to upload a video?</p>
  
  <pre><code>&lt;div id="title"&gt;Upload Videos&lt;/div&gt;
  &lt;div class="vidUpload"&gt;
      &lt;form id="vidUpload" enctype="multipart/form-data"&gt;
  &lt;input name="vidName" type="text" required="required" id="vidName" placeholder="Enter Video Name Here" title="Video Name"&gt;
  &lt;br&gt;
  &lt;textarea name="videoDescription" id="videoDescription" required class="videoDescription" placeholder="Enter Video Description Here" title="Enter Video Description Here"&gt;&lt;/textarea&gt;
  
  &lt;select name="select" required class="choosevidCat" id="choosevidCat"&gt;
  &lt;option value=""&gt;Choose the Catagory for your Video Here&lt;/option&gt;
              &lt;?php 
      $sql = ("SELECT albumId, albumName, albumSelect FROM albums");
  if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  
  $result = mysqli_query($mysqli, $sql);
  
  while($row = mysqli_fetch_array($result)) {
  $albumid = ($row['albumId']);
  $album_name = ($row['albumName']);
  $album_name1 = ($row['albumSelect']);
  echo "&lt;option value=".$album_name1. "&gt;$album_name&lt;/option&gt;";
  }
  
  ?&gt;
  
  
  &lt;option id="createCat" value="createCatagory"&gt;Create New Catagory Here&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;input type="file" name="video" id="video"&gt;
  &lt;input type="button" name="videoToUpload" id="videoToUpload" value="Upload"&gt;
  
  &lt;/form&gt;
  &lt;div id="loader"&gt;&lt;/div&gt;
  &lt;div id="viduploadResult"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>jquery</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  $(document).ready(function() {
  
      $("#videoToUpload").click(function() {
  
  var vidName = $("#vidName").val();
  var videoDescription = $("#videoDescription").val();
  var albumName1 = $("#choosevidCat").val();
  var vidFile =$("#video").val();
  
    // Put an animated GIF image insight of content
    $("#loader").empty().html('&lt;img src="/images/loader.gif" class="vidloader1"/&gt;');
  
          $.post("includes/vid_upload.inc.php",{vidName: vidName, videoDescription: videoDescription, albumName1: albumName1,  vidFile: vidFile}, function(json)
           {
  
              if(json.result === "success") {
  
          $("#viduploadResult").html( "The Video "+vidName+" has been Uploaded!");
  
  
  //        // First remove all the existing options
  //       $('#choosevidCat').empty();
  //
  //        // Load the content:
  //        $('#choosevidCat').load(location.href + "#choosevidCat &gt; *");
  
      }else{
          $("#viduploadResult").html(json.message);
      }   
  
           });
      });
  })
  &lt;/script&gt;
  </code></pre>
  
  <p>I have spent hours looking at API's like blueimp etc, I just want to upload a video file and put it on my server from the form I have here. 
  Any help would be greatly appreciated</p>