I haven't been able to find any solutions here so far, so I really need to ask about this.
I'm building a video-hosting site, using PHP and mySQL and where video tutorials (called "answers" in my site) are uploaded in response to requests for help in hobby-making activities.
I need my site to extract the metadata of newly uploaded files during the creation of a new video record (to be put into a answers table in mySQL).
So far, I got the basic uploading and storing of new files working perfectly and you can read the code for yourself here:
function insert_answer($answer) {
    global $db;
    $errors = validate_answer($answer);
    if(!empty($errors)) {
      return $errors;
    }
        $fileowner = $_SESSION['user_id'];
        $filename = $_FILES['videoUpload']['name'];
        $filename = $fileowner.'-'.$filename;
        $filetype = $_FILES['videoUpload']['type'];
        $filesize = $_FILES['videoUpload']['size'];
        $cname = str_replace(" ","_",$filename);
        $tmp_name = $_FILES['videoUpload']['tmp_name'];
        $target_path = "../private/media/";
        $target_file = $target_path . basename($cname);
        $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); 
        move_uploaded_file($_FILES['videoUpload']['tmp_name'], $target_file);
    $author = $_SESSION['user_id'];  
    $mysqldate = date('H:i d/m/Y');
    $sql = "INSERT INTO answers ";
    $sql .= "(user_id, request_id, title, content, tags, date, video, length) ";
    $sql .= "VALUES (";
    $sql .= "'" . db_escape($db, $author) . "',";
    $sql .= "'" . db_escape($db, $answer['request_id']) . "',";
    $sql .= "'" . db_escape($db, $answer['title']) . "',";
    $sql .= "'" . db_escape($db, $answer['content']) . "',";
    $sql .= "'" . db_escape($db, $answer['tags']) . "',";
    $sql .= "'" . db_escape($db, $mysqldate) . "',";
    $sql .= "'" . db_escape($db, $target_file) . "',";
    $sql .= "'" . db_escape($db, $answer['length']) . "' ";
    $sql .= ")";
    $result = mysqli_query($db, $sql);
    // For INSERT statements, $result is true/false
    if($result) {
      return true;
    } else {
      // INSERT failed
      echo mysqli_error($db);
      db_disconnect($db);
      exit;
    }
  }
Right now, I am missing the solution to record the length of the uploaded videos and, possibly, any other metadata I may not be aware could be useful. I previously tried exif_read_data to extract that metadata until I learned that it only works on image files.
To be crystal clear, when creating a new record for the answers table, I select the file to upload as well as fill out a form before clicking submit. Once I click submit, the site should then extract the metadata and record them into the new entry.
Please not that I am building this website in Plesk as part of a university assignment so I'm not sure if server-side tools would work and I am still rather new to web design.
Any help and advice will be appreciated.