"; define("MAX_FILE_SIZE", 1024 * 1024 * 50); define("UPLOAD_DIR", "files/"); $type = strtolower(end(explode('.', $_FILES['uploaded']['name']))); $file = $id . "." . $type; echo "Destination file: " . $file; echo "

Wow! ".count($permitted)." extensions supported! Request more extensions

"; if (in_array($type,$permitted) && $_FILES['uploaded']['size'] > 0 && $_FILES['uploaded']['size'] <= MAX_FILE_SIZE) { switch ($_FILES['image']['error']) { case 0: if (!file_exists(UPLOAD_DIR . $file)) { $success = move_uploaded_file($_FILES['uploaded']['tmp_name'], UPLOAD_DIR . $file); } else { unlink(UPLOAD_DIR . $file); $success = move_uploaded_file($_FILES['uploaded']['tmp_name'], UPLOAD_DIR . $file); } if ($success) { $result = "Your file was uploaded.
« Back to Keepit"; $pieces = explode('.', $_FILES['uploaded']['name']); $query = mysql_query("insert into keepit_docbank (id,title,container,owner,type,dateMod) values('$id','" . $pieces[0] . "','$use_dir','$username','" . $type . "',NOW())") or die("Can't connect: " . mysql_error()); } else { $result = "Error uploading your file. Please try again. If this problem persists, contact Keepit and we will try to help you."; } break; case 8: $result = "Error uploading your file. Please try again. If this problem persists, contact Keepit and we will try to help you."; break; case 4: $result = "You didn't upload a file."; break; default: break; } } else { $result = "Your file is either too big or is not a file of the specified upload types."; } } if (isset($result)) { echo "

$result

"; } ?>