
<?php
include('connection.php');

//echo 'helo';


$file1=$_POST['file1'];
//echo $file1;
$dept_name=$_POST['dept_name'];
//echo $dept_name;
$sub_dept_name=$_POST['sub_dept_name'];
$date=$_POST['date'];
//echo $date;

 
 if ($_FILES["file1"]["error"] > 0)
          {
          echo "Error: " . $_FILES["file1"]["error"] . "<br>";
          $error = 'File Contain Error';
          }
        else
           {           
              $filename=$_FILES["file1"]["name"];
              $src = $_FILES["file1"]["tmp_name"];
		            $dest ="img/".$filename;

		            file_put_contents($dest,file_get_contents($src));
		            chmod($dest, 0777);
		           echo 'uploaded';
            
     
   
		         

	$sql="INSERT INTO dept_pdf_upload VALUES ('','$dept_name','$sub_dept_name','$date','$file1','visible',NOW())";
//echo $sql;
$res=mysqli_query($GLOBALS["___mysqli_ston"], $sql) or die("Error message". mysqli_errno($GLOBALS["___mysqli_ston"]));

echo '<script>
alert("Documents Uploaded..!!!");
window.location.href="dept_upload.php"
</script>';
            
            
		         }
		         
			         

		

?>
