<?php

if(isset($_POST["upfile"]))
 {
	 
	if ($_FILES['file']['error']>0)
	{
		echo ' Taisir Error:' .$_FILES['file']['error'].' </br>';
		}
	else {
		
		echo ' Name:' .$_FILES['file']['name'].' </br>';
		echo ' Type:' .$_FILES['file']['type'].' </br>';
		echo ' Size:' .($_FILES['file']['size']/1024).'Kb </br>';
		
		echo ' Path:' .$_FILES['file']['tmp_name'] .' </br>';
		move_uploaded_file($_FILES['file']['tmp_name'], "up/".$_FILES['file']['name']."");

	echo " the file store in:  up/".$_FILES['file']['name'].""  ;
	echo " <img src='up/".$_FILES['file']['name']."'/>";
$db= mysqli_connect("localhost","taisir","123","imgexam");
$img=$_FILES['file']['name'];
$name=$_POST['name'];
$email=$_POST['email'];
$sql="INSERT INTO mytable (fullname, email, image) VALUES ('$name','$email', '$img')";
mysqli_query($db,$sql);

	
	}
		
	}
echo ' <form action="image.php" method="post" enctype="multipart/form-data">
    <label>Name: </label>
	<input type="text" name="name" ></br>
	
  <label>Email: </label>
	<input type="text" name="email" id="fileToUpload"></br>
	Select image to upload:</br>
	<input type="file" name="file" id="fileToUpload">
    <input type="submit" value="Upload" name="upfile">
</form> ';
?>