<?php
$con = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

$myfile=$request->getParsedBody()['file'];

$response=array();

	 $path = pathinfo("../pwe",PATHINFO_BASENAME);

$uploaddir = '../pwe';
$uploadfile = $uploaddir . basename($_FILES['myfile']['name']);
	
if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile)) 
   {
     echo "";
   }
   else 
        {
      echo "Upload failed";
        }


$myfile = $_FILES["file"]["type"];

$sql="INSERT INTO ajith (file) VALUES ('$myfile')";

$res= $con->query($sql);
	
if($res==true)
{
		$data=array(
	"pdf_file"=>$myfile,
	);
	    $message=$data;

	$response=array('status' => "true",'Message' => "Data inserted successfully",'pdf_file' => $message);
echo json_encode($response);
        
}
        else{
          $response=array('status' => "false",'Message' => " insert data failed");
         echo json_encode($response);
        }   
      
 
      


?>