4194304) {
$errors[] = "File exceeds 4 megabytes";
}
if (!$_POST['comment']) {
$errors[] = "A comment is required";
}
if (!$_POST['email']) {
$errors[] = "Your email is required";
}
if ($errors) {
echo "
\n";
echo "
The following error(s) occured
\n";
foreach ($errors as $error) {
echo "$error
\n";
}
echo "\n";
} else {
if (file_exists("images/".$_FILES['image']['name'])) {
$s = 1;
while (file_exists("images/".$s."-".$_FILES['image']['name'])) {
$s++;
}
$path = "images/".$s."-".$_FILES['image']['name'];
} else {
$path = "images/".$_FILES['image']['name'];
}
move_uploaded_file($_FILES['image']['tmp_name'], $path);
echo "Thank you for submitting your image. We will get back to you as soon as possible\n";
}
} else {
echo '';
}
$types = array(
"image/jpeg",
"image/png",
"image/gif",
"image/bmp",
"image/tiff",
"image/x-tga"
);
function file_check($file) {
global $types;
foreach ($types as $type) {
if ($file == $type) $match = 1;
}
return ($match) ? TRUE : FALSE;
}
?>