<!-- nama file : file_upload.html -->

<html>
<head>
	<title>Demo Upload</title>
</head>

<body>
<h2>Demo Upload File</h2>

<?php

if (isset($_POST['btnSubmit'])) {
	$temporary	= $_FILES['userfile']['tmp_name'];
	$namafile	= $_FILES['userfile']['name'];
	
	#lokasi tujuan = direktory aktif
	$tujuan	= getcwd() . "\\" . $namafile;
	
	if (is_uploaded_file($temporary)) {
		#memindahkan file temporary ke directory aktif
		move_uploaded_file($temporary, $tujuan);
		
		print "<p>Proses Upload berhasil. </p>";
		print "File Temporary : ". $temporary . "<br />";
		print "File Tujuan    : ". $tujuan . "<br />";
		print "Ukuran File    : ". $_FILES['userfile']['size'] . "<br />";
		print "Type MIME      : ". $_FILES['userfile']['type'] . "<br />";
	}else{
		print "<p>Proses Upload File Gagal </p>";
	}
}
?>

</body>
</html>

