<?php	
	include ('../../inc/inc.koneksi.php');
	session_start();
	
	$kodest	 	= $_POST['u_kodest'];
	$foto	 	= $_FILES['u_foto']['name'];
	$fileSize	= $_FILES['u_foto']['size'];
				
	if ($fileSize>2000000)
		echo "Ukuran file tidak boleh melebihi 2 MB. Silahkan <a href=\"javascript:history.back()\">Ulang Kembali</a>";
    else{
		if (strlen($foto)>0) {
			if(is_uploaded_file($_FILES['u_foto']['tmp_name'])) {
				move_uploaded_file ($_FILES['u_foto']['tmp_name'], "../../foto/".$foto);			
				mysql_query("UPDATE stock SET foto='$foto',lastupdate=now() WHERE kode_st= '$kodest'");
			}
		}
	}
?>
<script type="text/javascript">	
	history.back();
</script>