<html>
<head>
	<title>Listing 7-4</title>
</head>
<body>
<?php
	//check for file upload
	if(isset($_FILES['upload_test']))
	{
		if($_FILES['upload_test']['error'] != UPLOAD_ERR_OK)
		{
			print("Upload unsuccessful!<br>\n");
		}
		else
		{
			//delete the file
			unlink($_FILES['upload_test']['tmp_name']);
			//show information about the file
			print("Local File: " .
				$_FILES['upload_test']['tmp_name'] . "<br>\n");
			print("Name: " .
				$_FILES['upload_test']['name'] . "<br>\n");
			print("Size: " .
				$_FILES['upload_test']['size'] . "<br>\n");
			print("Type: " .
				$_FILES['upload_test']['type'] . "<br>\n");
			print("<hr>\n");
		}
	}
?>
<form enctype="multipart/form-data"
	action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1024000">
<input name="upload_test" type="file">
<input type="submit" value="test upload">
</form>
</body>
</html>