I am having a strange problem where my query to Insert values into a database are not being added. I am using MySQL through terminal and the file I am doing these queries through are on my AWS ubuntu instance.
Here is the upload.php file located on my AWS instance:
<?php
    if(isset($_POST["submit"])){
        $check = getimagesize($_FILES["image"]["tmp_name"]);
        if($check !== false){
            $image = $_FILES['image']['tmp_name'];
            $imgContent = addslashes(file_get_contents($image));
            $servername = "localhost";
            $username = "NOTREAL";
            $password = "NOTREAL";
            $dbname = "CS4830";
            //connect
            $db = new mysqli($servername, $username, $password, $dbname); 
            // Check connection
            if($db->connect_error){
                die("Connection failed: " . $db->connect_error);
            }
            else{
                echo "Successful";
            }
            $dataTime = date("Y-m-d H:i:s");    
            //Insert image content into database
            $insert = $db->query("INSERT into images (image, created) VALUES ('$imgContent', '$dataTime')");
            if($insert){
                echo "<br/>";
                echo "File uploaded successfully.";
            }else{
                echo "<br/>";
                echo "File upload failed, please try again. ";
            } 
        }else{
            echo "Please select an image file to upload.";
        }
    }
?>
When I upload an image and the php runs, I end up getting "File upload failed, please try again." printed out on my screen. - The table is named images. Can Anyone identify the possible issue? I thought maybe it had something to do with permissions but the credentials are correct and I can't imagine what permissions would be lacking. Other than that I'm lost at this point. Thank you.
(A simple demo site) http://ec2-54-158-61-31.compute-1.amazonaws.com/images/
 
     
     
    