";
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 "