php
if(isset($_POST['save_albums']))
{
$name = $_POST['album_name'];
$designation = $_POST['album_designation'];
$images = $_FILES["album_image"]["name"];
if(file_exists("uploads/" .$_FILES["album_image"]["name"]))
{
$store = $_FILES["album_image"]["name"];
$_SESSION['status'] = "Image already exists.'.$store.' ";
header('Location: albums.php');
}
else
{
$query = "INSERT INTO albums ('name','designation','images') VALUES ('$name','$designation','$images')";
$query_run = mysqli_query($connection,$query);
if($query_run)
{
move_uploaded_file($_FILES["album_image"]["tmp_name"], "uploads/".$_FILES["album_image"]["name"]);
$_SESSION['success'] = "Image Added";
header('Location: albums.php');
}
else
{
$_SESSION['status'] = "Image Not Added";
header('Location: albums.php');
}
}
}
i am watching a video of funda Web It on YouTube and he did this code i do the same thing and the image it is not uploading can someone help me
<?php
include('security.php');
include('includes/header.php');
include('includes/navbar.php');
?>
<!-- modal medium -->
<div class="modal fade" id="albumsModal" tabindex="-1" role="dialog" aria-labelledby="mediumModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="mediumModalLabel">Albums</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="login-logo">
<a href="#">
<img src="images/icon/logo.png" alt="CoolAdmin">
</a>
</div>
<div class="login-form">
<form action="albums_code.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label>Name</label>
<input class="au-input au-input--full" type="text" name="album_name" placeholder="Enter Name" required>
</div>
<div class="form-group">
<label>Designation</label>
<input class="au-input au-input--full" type="text" name="album_designation"
placeholder="Enter Designation" height="38px" required>
</div>
<div class="form-group">
<label>Upload Image</label>
<input class="au-input au-input--full" type="file" name="album_image" id="album_images"
height="38px" required>
</div>
<button class="au-btn au-btn--block au-btn--green m-b-20" name="save_albums"
type="submit">Save</button>
<button type="button" class="au-btn au-btn--block au-btn--red m-b-20"
data-dismiss="modal">Cancel</button>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- MAIN CONTENT-->
<div class="main-content">
<div class="section__content section__content--p30">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<i class="mr-2 fa fa-align-justify"></i>
<strong class="card-title" v-if="headerText">Albums</strong>
</div>
<div class="card-body">
<button type="button" class="btn btn-secondary mb-1" data-toggle="modal"
data-target="#albumsModal">
ADD
</button>
<?php
if(isset($_SESSION['success']) && $_SESSION['success'] != "")
{
echo '<h4 class = "alert alert-success text-center">' .$_SESSION['success'] .'</h4>';
unset($_SESSION['success']);
}
if(isset($_SESSION['status']) && $_SESSION['status'] != "")
{
echo '<h4 class = "alert alert-danger text-center ">' .$_SESSION['status'] .'</h4>';
unset($_SESSION['status']);
}
?>
</div>
</div>
</div>
</div>
<!-- end modal medium -->
<div class="row">
<div class="col-lg-12">
<div class="table-responsive table--no-card m-b-30">
<!-- Retreive Data From Database And Display In Table -->
<table class="table table-borderless table-striped table-earning">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Designation</th>
<th>Image</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td>
<button type="submit" class="btn btn-success"><i
class="fas fa-edit pr-2"></i>Edit</button>
</td>
<td>
<button type="submit" class="btn btn-danger"><i
class="fas fa-trash-alt pr-2"></i>Delete</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include('includes/scripts.php');
include('includes/footer.php');
?>