<?php
require_once("headHotelStaff.php");
//session_start();
//set_time_limit();
if(isset($_POST["post"])){
ini_set('upload_max_filesize', '2M');
ini_set('post_max_size', '2M');
ini_set('max_input_time', 300);
ini_set('max_execution_time', 300);
 
 if( isset($_FILES['imagefile']['name']) && isset($_POST['hiD']) && isset($_POST['title']) && isset( $_FILES["imagefile"]["tmp_name"])){
 
 
 $fn = $_FILES["imagefile"]["name"]; 
 
 $type=$_FILES["imagefile"]["type"];

$size=$_FILES["imagefile"]["size"];

$error=$_FILES["imagefile"]["error"];

$tmp_name=$_FILES["imagefile"]["tmp_name"];

$ext = pathinfo($fn, PATHINFO_EXTENSION);

$tit = $_POST['title'];  $hnm = $_POST['hiD'];

$allowedtype=array('png','jpg','jpeg','gif','jpeg','JPG','JPEG','GIF','PNG');

//list($height,$width)=getimagesize($tmp_name);


//echo " Name:  ".$fn ."Type:  ".$type ." Size:  ".$size."  Temp_Name:  ".$tmp_name."  Extension:  ".$ext.$hid;

// alternative way for checking type if($ext=='png' || $ext=='JPEG' || $ext=='gif' || $type=='jpg')
 
if(!$con->vImageType($ext,$allowedtype) || !$con->vImageError($error)  || !$con->vImageSize($size) || !$con->vImageExist($fn) || !$con->vTitle($tit) || !$con->vImageSelectF($fn) )
  {
  	require("repostHotelImageUploadForm_staff.php");
  }
  else{
    require("successFullHImageUpload_staff.php");
      }
	


      }
else
	{
		echo "Error occured when page load!..";
	}
}
else
{
	echo "Oops error occured!..";
}