<LINK href="images/index.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
    function refreshAndClose() {
        window.opener.location.reload(true);
        window.close();
    }
</script>
<body onbeforeunload="refreshAndClose();">
<?php
$allowed = array('pdf');
if(isset($_FILES['upl']) && $_FILES['upl']['error'] == 0){
	$extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
	if(!in_array(strtolower($extension), $allowed)){
		echo '{"status":"error"}';
		exit;
	}
$dir1 = $_POST["dir"];
//if(move_uploaded_file($_FILES['upl']['tmp_name'], ''.$dir1.'/'.$_FILES['upl']['name'])){
$namafile1 = $_POST["namafile"];
$path= $dir1."/".$namafile1;
if(move_uploaded_file($_FILES['upl']['tmp_name'], $path)){

include("../index.cma.db.php");
mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$mytable = $_POST['table'];
$id1 = $_POST['uid'];
$query = "UPDATE $mytable Set tu_filesc  = '1' where tu_id = '$id1'";  
$result = mysql_query($query); 
		//-----------------
		echo '<b>UPLOAD FILE TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>';
		exit;
	}
}
echo '{"status":"error"}';
exit;
?>
