<?php 	
session_start();
require_once '../../Server/connection.php';
include('../includes/session.php');
if($_POST){
  $file_id = $_POST['file_id'];
  
 
	
	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 (file_id,fileName) values ('$file_id','$location')");
		
	          }
	          }
			  
			  
   
	$_SESSION['success_message'] = "File Has Been Uploaded Successfully";
                        header("Location: ../addFiles.php");
                             exit();
     
	
}