GIF89a
<?php ob_start(); ini_set('error_reporting', E_STRICT); include("connect.php"); mysqli_set_charset($conn,'utf8'); date_default_timezone_set('Asia/Kolkata'); $type=$_POST['type']; if($_FILES["image"]["name"]=="") { echo '<script>window.location.href="homeBanner.php";</script>'; } else { $temp = explode(".",$_FILES["image"]["name"]); $target_dir='image/'.date('Ymdhis').'.'.end($temp); if (file_exists($target_dir)) { echo '<script>alert("Image already exist | try another file");</script>'; echo '<script>window.location.href="homeBanner.php";</script>'; } else { $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="homeBanner.php";</script>'; } else { move_uploaded_file($_FILES["image"]["tmp_name"],$target_dir); $sql="UPDATE `homebanner` SET `image`='".$target_dir."',`type`='".$type."' WHERE `sr`='".$srr."'"; $rs=mysqli_query($conn,$sql); if($rs>0) { echo '<script>window.location.href="homeBanner.php";</script>'; } else { echo '<script>alert("Can not Update Image.");</script>'; echo '<script>window.location.href="homeBanner.php";</script>'; } } } } ?>