D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
slg.encodersunlimited.com
/
slgadmintoys
/
Filename :
add_gallery.php
back
Copy
<?php include 'config.php'; if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = $_POST['name']; $category = $_POST['category']; $image = $_FILES['image']['name']; $target = "uploads/" . basename($image); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $query = "INSERT INTO slgtoys_gallery (name, category, image) VALUES ('$name', '$category', '$target')"; if (mysqli_query($conn, $query)) { echo "<div class='alert alert-success'>Gallery image added successfully.</div>"; } else { echo "<div class='alert alert-danger'>Error: " . mysqli_error($conn) . "</div>"; } } else { echo "<div class='alert alert-danger'>Failed to upload image.</div>"; } } ?> <!DOCTYPE html> <html lang="en" data-theme="light"> <head> <?php include 'style.php'; ?> </head> <body> <?php include 'sidebar.php'; ?> <main class="dashboard-main"> <?php include 'header.php'; ?> <div class="dashboard-main-body"> <div class="card"> <div class="card-header"> <h5 class="card-title mb-0">Add Gallery Image</h5> </div> <div class="card-body"> <form method="POST" enctype="multipart/form-data"> <div class="mb-3"> <label class="form-label">Name</label> <input type="text" name="name" class="form-control" required> </div> <div class="mb-3"> <label class="form-label">Category</label> <input type="text" name="category" class="form-control" required> </div> <div class="mb-3"> <label class="form-label">Image</label> <input type="file" name="image" class="form-control" required> </div> <button type="submit" class="btn btn-primary">Add Image</button> </form> </div> </div> </div> <?php include 'footer.php'; ?> </main> </body> </html>