Is it possible to upload video to the server?

For pictures got to do, everything is OK. In dB saves deer pictures, the pictures in the folder are loaded and deduce where necessary. Is this a principle to upload videos?
// Create a connection to the server
$db = mysql_connect ("localhost","root",""); 
// Select database
mysql_select_db ("Hunter",$db);

// All uploaded files placed in this folder
$uploaddir = 'images/add_photo/';

// Pull out the required data
$file = $_POST['value'];
$name = $_POST['name'];

// Get the file extension
$getMime = explode('.', $name);
$mime = end($getMime);

// Select data
$data = explode(',', $file);

// Decode data encoded with MIME base64 algorithm
$encodedData = str_replace(' ','+',$data[1]);
$decodedData = base64_decode($encodedData);

// You can use this file name, or create a random name.
// We will create a random name!
$randomName = substr_replace(sha1(microtime(true)), ", 12).'.'.$mime;

// Create the image on the server
if(file_put_contents($uploaddir.$randomName, $decodedData)) {
 // Write the data image in the database
 mysql_query ("INSERT INTO images (date,catalog,filename) VALUES (NOW(),'$uploaddir','$randomName')");
 echo $randomName.":loaded successfully";
else {
 // Show error message if something goes wrong.
 echo "something went wrong. Make sure that the file is not corrupted!";
June 26th 19 at 14:02
1 answer
June 26th 19 at 14:04
function gener($length = 1) {
 $imagehistory = '0123456789QqWwEeRrTtYyUuIiOoPpaAssddffgghhjjkkllzzxxccvvbbnnmm';
 $length_need = min($length, strlen($imagehistory));

 $result = ";
 while (strlen($result) < $length)
 $result .= substr(str_shuffle($imagehistory), 0, $length_need); // *

 return $result;
$uploaddirvideo = 'assets/video/';
$uploadfilevideo = $uploaddirvideo.basename($gener.'.mp4');
move_uploaded_file($_FILES['videofile']['tmp_name'], $uploadfilevideo)

<input type="file" name="videofile" accept="video/mp4,video/x-m4v,video/*">

Find more questions by tags PHP