<?php 	
session_start();
require_once '../../Server/connection.php';
include('../includes/session.php');
if($_POST){
  $client_id = $_POST['client_id'];
  
 $role = 'DCO';
	
	if(!empty($_FILES['file']['name'])){
	foreach ($_FILES['file']['name'] as $key => $name){
		$newFilename = time() . "_" . $name;
		move_uploaded_file($_FILES['file']['tmp_name'][$key],'../../files/'.$newFilename);
		$location = '../../files/' . $newFilename;
		
		mysqli_query($conn,"insert into client_docs (client_id,role,fileName) values ('$client_id','$role','$location')");
		
	          }
	          }
			  
			  
   
	$_SESSION['success_message'] = "Customer File Has Been Uploaded Successfully";
                        header("Location: ../addCustoFiles.php?i=$client_id");
                             exit();
     
	
}