//Validate filetype:
if($uploadOk == 1 ){
    if($check !== false){
        //$uploadOk = 1;
        if($_FILES['uploadImage']['size'] > 1048576){
            echo '<div class="alert alert-danger"><strong>Warning!</strong> Sorry, your file is too large.</div>';
            $uploadOk = 0;
        }
    }else{
        echo '<div class="alert alert-danger"><strong>Warning!</strong> File is not an image.</div>';
        $uploadOk = 0;
    }

    if( ($imageFileType != 'jpg') && ($imageFileType != 'png') && ($imageFileType != 'jpeg') && ($imageFileType != 'gif') ){
        echo '<div class="alert alert-danger"><strong>Warning!</strong> Only jpg, jpeg, png, and gif files are allowed.</div>';
        $uploadOk = 0;
    }else

    if( ($mimeType != 'image/gif') && ($mimeType != 'image/jpeg') && ($mimeType != 'image/png') ){
        echo '<div class="alert alert-danger"><strong>Warning!</strong> Only jpg, jpeg, png, and gif files are allowed.</div>';
        $uploadOk = 0;
    }

}