<?php
if(isset($_POST['s_id'])){
		require_once('../../assets/config/config.php');
		$obj=new Database();
		$s_id=$_POST['s_id'];
		$s_name=$_POST['s_name'];
		$doc_name=$_POST['doc_name'];
		$doc_no=$_POST['doc_no'];
		$date=date('d-M-Y');
		$file_name=$_FILES['file']['name'];
		if (isset($_FILES['file']['name']))
		{
		// If the ‘pdf_file’ field has an attachment
			$file_name = $_FILES['file']['name'];
			$file_tmp = $_FILES['file']['tmp_name'];
			
			// Move the uploaded pdf file into the pdf folder
			move_uploaded_file($file_tmp,"../docs/".$file_name);                 
		$status=$obj->insert('students_documents',['student_id'=>$s_id,'student_name'=>$s_name,'document_name'=>$doc_name,'document_no'=>$doc_no,'date'=>$date,'path'=>$file_name]);
			if($status==1)
			{
				echo "<script>
				window.location.href ='../students.php?msg=1';</script>";
			}
		}
}
?>