<?
	$title = "Upload a File";
	$page = "upload";
?>
<?if(!$file) { ?>

<form action="FileUpload.phtml" enctype="multipart/form-data" method=POST>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type=file name=file size=29>
<input type="submit" value=" Send File ">
</form>

<? } else {
    if(!filetype("uploads")) {
        if(!@mkdir("uploads",0777)) {
            echo "Unable to create uploads directory - check permissions<br>\n";
			exit;
        }
    }
	$dest = "$DOCUMENT_ROOT/".dirname($PHP_SELF)."/uploads/$file_name";
	if(@exec("cp $file $dest")!=0) {
		echo "Unable to create $dest - check permissions<br>\n";
		exit;
	}
	unlink($file);
        echo "File uploaded successfully";
}
?>
