This code works in a good way, but I want to do a rename of the video before uploading Can you modify it for me?**
if (isset($_POST['but_upload'])) {
$name = $_FILES['file']['name'];
$namefilm = $_POST['namefilm'];
$year = $_POST['year'];
$wirte = $_POST['wirte'];
$dep = $_POST['dep'];
$about = $_POST['about'];
$time = time();
$target_dir = "../videos/";
$target_file = $target_dir.$_FILES["file"]["name"];
$file = addslashes(file_get_contents($_FILES["image"]["tmp_name"]));
if ($name == ""
or $namefilm == ""
or $year == ""
or $wirte == ""
or $dep == ""
or $about == ""
or $target_file == ""
or $file == "") {
echo 'erorr';
} else {
$videoFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
$extensions_arr = array("mp4", "avi", "3gp", "mov", "mpeg");
if (in_array($videoFileType, $extensions_arr)) {
if (move_uploaded_file($_FILES['file']['tmp_name'], $target_file)) {
$query = "INSERT INTO videos (name, location, namefilm, image, dep, wirte, yaer, time, about) VALUES('" . $name . "', '" . $target_file . "', '" . $namefilm . "', '" . $file . "', '" . $dep . "', '" . $wirte . "', '" . $year . "', '" . $time. "', '" . $about . "')";
mysqli_query($con, $query);
echo 'done';
}
} else {
echo 'erorr';
}
}
}