Example #1
0
    echo $imageFileType . "<br>";
    #$something = $_FILES["image"]["tmp_name"];
    #echo $something . "<br>";
    #echo "got here!2222222222<br>";
    $fileName = $_FILES["image"]["name"];
    echo "got here!br>";
    #$fileArray = explode(".",$fileName);
    #$extension = $fileArray[1];
    $extensionType = "image/" . $imageFileType;
    echo $extensionType . "<br>";
    if ($extensionType == "image/jpg" or "image/JPG") {
        $extensionType = "image/jpeg";
    }
    if ($Gallery->filetypeCheck($extensionType)) {
        echo "True";
        $Gallery->newGalleryImage($_FILES["image"], $_POST["caption"]);
    } else {
        echo "<p class='bg-danger'>Something is wrong with your upload...</p>";
    }
}
?>

 <!DOCTYPE html>
<html>
	<head>
		<title>Gallery Display</title>
		<link rel="stylesheet" type="text/css" href="style.css">
		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
	</head>
	<body id="main">
Example #2
0
<?php

# Making sure that we bring in our Gallery class
require "class.Gallery.php";
# Checking to see if the form was completed and a file was selected
if (!empty($_POST) && !empty($_FILES)) {
    # Check for a valid file type
    if (Gallery::filetypeCheck($_FILES["uploadImage"]["type"])) {
        # Upload the image and indicate success
        Gallery::newGalleryImage($_FILES["uploadImage"]);
        $status = "success";
    } else {
        # Bad file type or other failure
        $status = "failure";
    }
    # Redirect to same page; trigger page refresh
    header("location: index.php?status={$status}");
}
?>
<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<link rel="stylesheet" href="gallery.css">
	<title>Simple Gallery</title>
</head>
<body>
	<div class="clearfix">
		<?php 
switch ($_GET["status"]) {
    case "success":