<?php
include '../../conn.php';

$id=$_POST['id'];


			
          $sql ="select * from `doctors` where id='$id' ";
            $result = mysqli_query($con,$sql);
            $noofuser=0;
            while($row = mysqli_fetch_array($result)){
             $noofuser=$noofuser + 1;
			}
			
			
			
if($noofuser > 0){

$valid_extensions = array('jpeg', 'jpg', 'png', 'gif', 'bmp' , 'pdf' , 'doc' , 'ppt'); // valid extensions
$path = 'images/user/'; // upload directory

$img = $_FILES['image']['name'];
$tmp = $_FILES['image']['tmp_name'];
// get uploaded file's extension
$ext = strtolower(pathinfo($img, PATHINFO_EXTENSION));
// can upload same image using rand function
$final_image = rand(1000,1000000).$img;
// check's valid format
		if(in_array($ext, $valid_extensions)) 
		{ 
		$path = $path.strtolower($final_image); 
		move_uploaded_file($tmp,'../../'.$path);
		}
$path=$baseimage.$path;

// $valid_extensions = array('jpeg', 'jpg', 'png', 'gif', 'bmp' , 'pdf' , 'doc' , 'ppt'); // valid extensions
$registerfile = 'images/user/'; // upload directory

$img = $_FILES['registerfile']['name'];
$tmp = $_FILES['registerfile']['tmp_name'];
// get uploaded file's extension
$ext = strtolower(pathinfo($img, PATHINFO_EXTENSION));
// can upload same image using rand function
$final_image = rand(1000,1000000).$img;
// check's valid format
		if(in_array($ext, $valid_extensions)) 
		{ 
		$registerfile = $registerfile.strtolower($final_image); 
		move_uploaded_file($tmp,'../../'.$registerfile);
		}
$registerfile=$baseimage.$registerfile;

$insert = $con->query("UPDATE `doctors` SET  `qualifactionfile`='$path',`registerationfile`='$registerfile' WHERE id='$id'");

        
if($insert > 0)
{ 
  echo 101;
}
}

else{
    echo '404';
}

?>