GIF89a php
Current File : /home/hencockfreshchic/public_html/admin.cpanel/uploads/headerImage.php
<?php
ob_start();
ini_set('error_reporting', E_STRICT);
include("connect.php");
$img_name=mt_rand(10,100);
// target directory
$target_dir1='prod_image/'.trim($_FILES["himage"]["name"]);
$url1="prod_image/".trim($_FILES["himage"]["name"]);

//unlink($target_dir1);

if (file_exists($target_dir1)) {
	unlink($target_dir1);
   echo '<script>alert("File already exist | Click ok to modify this);</script>';
   move_uploaded_file($_FILES["himage"]["tmp_name"],$target_dir1);
$sql="UPDATE `web_details` SET `header_logo`='".$url1."' WHERE `sr`=1";
$rs=mysqli_query($conn,$sql);
if($rs>0)
{
	 echo '<script>alert("Header logo has been updated");</script>';
 	echo '<script>window.location.href="webconfigform.php";</script>';
}
else
{
 	echo '<script>alert("Unable to update header logo");</script>';
 	echo '<script>window.location.href="webconfigform.php";</script>';

}
}
else
{
	$FileType = strtolower(pathinfo($target_dir1,PATHINFO_EXTENSION));
	if($FileType != "png" && $FileType != "jpg" && $FileType != "jpeg" )
{
	// file format not supportedonly images allows
	 echo '<script>alert("Invalid image format");</script>';
 	echo '<script>window.location.href="webconfigform.php";</script>';
	
}
else{
move_uploaded_file($_FILES["himage"]["tmp_name"],$target_dir1);
$sql="UPDATE `web_details` SET `header_logo`='".$url1."' WHERE `sr`=1";
$rs=mysqli_query($conn,$sql);
if($rs>0)
{
	 echo '<script>alert("Header logo has been updated");</script>';
 	echo '<script>window.location.href="webconfigform.php";</script>';
}
else
{
 	echo '<script>alert("Unable to update header logo");</script>';
 	echo '<script>window.location.href="webconfigform.php";</script>';

}

}
}


// check total images



?>