GIF89a
<?php ob_start(); ini_set('error_reporting', E_STRICT); include("connect.php"); mysqli_set_charset($conn,'utf8'); date_default_timezone_set('Asia/Kolkata'); $prod_id=$_POST['prod_id']; $temp = explode(".",$_FILES["image"]["name"]); $target_dir='prod_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="productImage.php";</script>'; } else { move_uploaded_file($_FILES["image"]["tmp_name"],$target_dir); $sql="UPDATE `products` SET `image`='".$target_dir."' WHERE `sr`='".$prod_id."'"; $rs=mysqli_query($conn,$sql); if($rs>0) { echo '<script>window.location.href="productImage.php";</script>'; } else { echo '<script>alert("Unable to update product image. Please contact to developers.");</script>'; echo '<script>window.location.href="productImage.php";</script>'; } } ?>