43 lines
1.8 KiB
PHP
43 lines
1.8 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include ('includes/functions.php');
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
$appointment_id =isset($_POST['appoint'])?$_POST['appoint']:$_POST['appointment_id'];
|
|
if($appointment_id==null || $appointment_id=='' ) {
|
|
$maxId="SELECT MAX(`checkup_id`) as 'id' FROM `checkup_form`";
|
|
$result_maxId = @mysqli_query($conn,$maxId);
|
|
while ($row_maxId = @mysqli_fetch_array($result_maxId)) {
|
|
$appointment_id= ($row_maxId['id']+1);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
//echo "shu";
|
|
error_log('apoiny'.$appointment_id);
|
|
$emp_id=$_REQUEST['emp_id'];
|
|
$file_path=$_FILES['file_medical_exam']['tmp_name']; //pdf is the name of the input type where we are uploading files
|
|
$file_type=$_FILES['file_medical_exam']['type'];
|
|
$file_size=$_FILES['file_medical_exam']['size'];
|
|
$file_name=$_FILES['file_medical_exam']['name'];
|
|
//$medical_exam_id=$_REQUEST['medical_exam_id_doc'];
|
|
if ($file_name != ""){
|
|
$data=mysqli_real_escape_string($conn,file_get_contents($file_path));
|
|
|
|
$query="INSERT INTO medical_document SET medical_doc_desc='".$_POST['medical_exam_document']."',medical_doc = '".$data."',medical_doc_name='".$file_name."',medical_doc_type='".$file_type."',emp_id='".$emp_id."',checkup_id='".$appointment_id."'";
|
|
|
|
error_log("OPD UPLOAD QUERY::" .$query);
|
|
// query to insert file in database
|
|
//”field_name” is the name of the field where we are uploading pdf files
|
|
|
|
if (! $result = @mysqli_query($conn,$query )) {
|
|
$data ['status'] = 500;
|
|
error_log ( "Failed to upload document Exception:" . mysqli_error($conn) . " Query::: " . $query );
|
|
//rollback ();
|
|
exit ( mysqli_error($conn) );
|
|
}
|
|
}
|
|
|
|
|
|
|
|
?>
|