<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>XIG Uploader</title>
	</head>
<body leftmargin="0" topmargin="0" rightmargin="0" bgcolor="#FFFFFF" text="#000000" scroll="auto">
<?
$filedir = "./imagedir";

$receivedok = 0;
if ($_FILES){
	echo "<pre>\n";
	#print_r($_FILES[userfile]);
	$sentfilename = strtolower(addslashes($_FILES['userfile']['name']));
	$sentfiletype = addslashes($_FILES['userfile']['type']);
	$sentfilesize = $_FILES['userfile']['size'];
	$sentfileparts = explode(".",$sentfilename);
	$ext = $sentfileparts[(sizeof($sentfileparts) - 1)];
	$ext = strtolower(substr($ext,0,3));
	if ($ext != "jpg"){ echo "WRONG FILE TYPE ($sentfilename)!!!"; }
	#if (file_exists("$filedir/$sentfilename")){ unlink("$filedir/$sentfilename"); }
	else{	move_uploaded_file($_FILES['userfile']['tmp_name'], "$filedir/$sentfilename"); 
			echo "File Received successfully.";
		}
	#Done 
	}

?>

<center>
<form enctype="multipart/form-data" action="<? echo "$_SERVER[PHP_SELF]"; ?>" method="post">
<table width="600" cellpadding="0" cellspacing="0" border="0">
<tr><td bgcolor="#840000" align="center" valign="middle">
<br><p>

<input type="hidden" name="MAX_FILE_SIZE" value="5000000">
<input type="hidden" name="SID" value="">
<input type="hidden" name="page" value="">
Upload:&nbsp; <input name="userfile" type="file" size="50">
&nbsp;<input type="submit" name="submit" value="Upload">
<br><p>
</td></tr>
</table>
</form>
</center>