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']; $srr=$_POST['srr']; if($_FILES["image"]["name"]=="") { $sql="UPDATE `videos` SET `title`='".$title."',`video_id`='".$vid."',`datee`='".date('Y-m-d')."',`timee`='".date('h:i:s A')."',`type`='".$type."' WHERE `sr`='".$srr."'"; $rs=mysqli_query($conn,$sql); if($rs>0) { echo '<script>window.location.href="manageVideos.php";</script>'; } else { echo '<script>alert("Unable to update data.");</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="UPDATE `videos` SET `title`='".$title."',`video_id`='".$vid."',`thumbnail`='".$target_dir."',`datee`='".date('Y-m-d')."',`timee`='".date('h:i:s A')."',`type`='".$type."' WHERE `sr`='".$srr."'"; $rs=mysqli_query($conn,$sql); if($rs>0) { echo '<script>window.location.href="manageVideos.php";</script>'; } else { echo '<script>alert("Unable to update data.");</script>'; echo '<script>window.location.href="manageVideos.php";</script>'; } } } ?>