<?php
$submit = $_POST["submit"];

if (isset($submit))
{
	include "upfilefunction.php";
	
	$webName = upload($_FILES["upload"], "uploads/");
	/*
	//echo "hi";
	//print_r ($_FILES["upload"]);
	$name = $_FILES["upload"]["name"];
	$type = $_FILES["upload"]["type"];
	$tmp_name = $_FILES["upload"]["tmp_name"];
	$size = $_FILES["upload"]["size"];
	echo "name: $name<br>";
	echo "type: $type<br>";
	echo "tmp_name: $tmp_name<br>";
	echo "size: $size<br>";
	copy ($tmp_name, $name);
	echo "<img src=$name>";
	*/
	
	if ($webName != -1)
	{
		echo "<font face=verdana size=2>upload successful";
		echo "<br>the file URL is :</font>";
		echo "<input type=text size=50 value=\"uploads/$webName\">";
	}
	else
	{
		echo "cannot upload";
	}
	//exit;
}
?>
<form action=<?php echo $_SERVER["PHP_SELF"]; ?> method="post" enctype="multipart/form-data">
<font face="verdana" size=2>Upload file: </font><input type="file" name="upload"><input type="submit" name="submit" value="Upload file">
</form>