Wikipedia PHP script/The upload scriptprint "<title>File upload page</title>\n"; global $id , $instr , $removeFile ;
	if (isset($removeFile)) {
		if (is_dir("upload/$removeFile") ) {
			system ("rm -f /upload/$removeFile");
		}
		unset ( $removeFile ) ;
	}
	if (isset($Upload)) {
		$Upload_name = ereg_replace(" ", "_", $Upload_name);
		$abc = split("\.", $Upload_name);
		$num = exec ("df");
		$readata = substr($num,(strpos($num, "%")-2),2);
		if ($readata > 96) {
			print "<body bgcolor=white>\n";
			print "
Sorry, we are almost out of disk space. We can't let you upload any";
			print "files right now.\n";
			exit();
			}
		if (!is_dir("upload") ) {
			system ("mkdir upload"); 
			system ("chmod 777 upload");       
			}
		system ("cp $Upload upload/$Upload_name");
		system ("chmod 777 upload/$Upload_name");       
    $chec = mysql_query("select res_user from resumes where res_user='$username' and res_file_name='$Upload_name'
    and res_story_pk=$id");
    $nchec = mysql_num_rows($chec);
    if ($nchec == 0) {
      $input = mysql_query("insert into resumes (res_file_name, res_user, res_story_pk, res_update_date) values ('$Upload_name','$username', $id, current_date())");
    }
    print "<script language=javascript>\n";
    print "  function winclose(name){\n";
    print "     str=\"Your file was successfully uploaded!\"\n";
    print "     alert(str);\n";
    print "  }\n";  
    print "</script>\n";
    print "<body bgcolor=white onload=\"winclose('$name')\">\n";
  }
?>
<body bgcolor=white>
<?
    ####################################################################
    # Instruction on                                                   #
    ####################################################################
    global $id , $arean ;
    if ($instr != "off"){
	$instr = "on";
	print "Instructions:
 <a href=$PHP_SELF?id=$id&arean=$arean&instr=off>TURN INSTRUCTIONS\n"; print " OFF</a> \n"; print " | \n";
	print "    
\n"; print "<a href=$PHP_SELF?id=$id&arean=$arean&instr=on>TURN INSTRUCTIONS ON</a>
\n"; } print "
print "\n"; print " <form enctype=\"multipart/form-data\" action=$PHP_SELF?instr=$instr&id=$id&arean=$arean method=post>\n"; print " <input type=hidden name=max value=20096>\n"; print " <input name=Upload type=\"file\"> \n";
\n"; print " <input type=hidden name=update value=1>\n"; print " <input type=hidden name=step value=$step>\n"; print " <input type=submit value=UPLOAD>\n"; print "</form>\n"; print "
	if (is_dir("upload")) {
		$mydir = dir("upload");
			while ($entry = $mydir->read()) {
			if ($entry != "." and $entry != "..")
				$file = "yes";
			}
		$mydir->close();
		if ($file == "yes") {
			print "Previously-uploaded files:
";
			$mydir = opendir("upload");
			$i = 0;
			print "| " ; print "<a href=upload/$entry>$entry</a> | ".filesize("upload/$entry")." bytes | "; print "<a href=\"$PHP_THIS?id=$id&instr=$instr&arean=$arean&removeFile=$entry\">Click here to remove $entry.</a> | " ; print "
Click the left column to download the file.
Click the right column to remove the file.
?>