To add a photo to your gallery, Fill out the following form below. A heading and description is needed for the gallery. When selecting your photo, please note that it will automatically re-size your photo on the gallery.php page, so you may choose the large photo for your gallery.
";
} else
if ($_GET['act'] == "added") {
$uploaddir = $_SERVER['DOCUMENT_ROOT'] . "/galleryimages/";
$filename = $_FILES['picture']['name'];
$allowed_types = array(
"image/gif" => "gif",
"image/pjpeg" => "jpg",
"image/png" => "png",
"image/bmp" => "bmp",
"image/jpeg" => "jpg",
);
if(!array_key_exists($_FILES['picture']['type'], $allowed_types)) {
echo "Wrong file type! Please go back and try again.";
} else
if(file_exists($uploaddir . $filename)) {
echo "File already exists! Please go back and try again.";
} else
if (!$_POST['heading'] || !$_POST['description'] || !$_POST['picture']) {
echo "Field left blank, please go back and try again.";
} else {
copy($file, $uploaddir.$filename) or die("Could not copy image");
$sql = "INSERT INTO gallery (id,heading,description,picture) VALUES('','$_POST[heading]','$_POST[description]','$_POST[picture]')";
$result = mysql_query($sql);
echo "Success!";
}