GIF89a
<?php ob_start(); ini_set('error_reporting', E_STRICT); include("connect.php"); mysqli_set_charset($conn,'utf8'); date_default_timezone_set('Asia/Kolkata'); $title=$_POST['title']; $type=$_POST['type']; $vid=$_POST['vid']; $sql3="SELECT * FROM `videos` WHERE `video_id`='".$vid."' && `type`='".$type."'"; $rs3=mysqli_query($conn,$sql3); $chk3=mysqli_num_rows($rs3); if($chk3>0) { echo '<script>alert("This video already exist.");</script>'; echo '<script>window.location.href="manageVideos.php";</script>'; } else { $temp = explode(".",$_FILES["image"]["name"]); $target_dir='image/'.date('Ymdhis').'.'.end($temp); $FileType = strtolower(pathinfo($target_dir,PATHINFO_EXTENSION)); if($FileType != "png" && $FileType != "jpg" && $FileType != "jpeg" && $FileType != "gif") { // file format not supportedonly images allows echo '<script>alert("Invalid image format");</script>'; echo '<script>window.location.href="manageVideos.php";</script>'; } else { move_uploaded_file($_FILES["image"]["tmp_name"],$target_dir); $sql="INSERT INTO `videos`(`title`, `video_id`, `thumbnail`, `datee`, `timee`, `type`) VALUES ('".$title."','".$vid."','".$target_dir."','".date('Y-m-d')."','".date('h:i:s A')."','".$type."')"; $rs=mysqli_query($conn,$sql); if($rs>0) { echo '<script>window.location.href="manageVideos.php";</script>'; } else { echo '<script>alert("Unable to save data");</script>'; echo '<script>window.location.href="manageVideos.php";</script>'; } } } ?>