%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/www/website_6ca89795/admin/ |
Upload File : |
<?php
include('header.php');
?>
<?php
if (isset($_POST['Upload'])) {
include('../dbcon.php');
$category = mysqli_real_escape_string($conn, $_POST['category']);
$category_ar = mysqli_real_escape_string($conn, $_POST['category_ar']);
$galleryname = $_FILES['gallery']['name'];
$tempname = $_FILES['gallery']['tmp_name'];
$filetype = strtolower(pathinfo($galleryname, PATHINFO_EXTENSION));
$allowed_types = ['jpg', 'jpeg', 'png', 'gif'];
if (!in_array($filetype, $allowed_types)) {
echo "<script>alert('Invalid file type. Only JPG, JPEG, PNG, and GIF are allowed.');</script>";
} else {
$unique_name = uniqid('gallery_', true) . '.' . $filetype;
$upload_dir = "./dataimg/";
if (!file_exists($upload_dir)) {
mkdir($upload_dir, 0777, true);
}
$upload_path = $upload_dir . $unique_name;
if (move_uploaded_file($tempname, $upload_path)) {
$qry = "INSERT INTO `service_category`(`category`, `category_ar`, `image_gallery`)
VALUES ('$category', '$category_ar', '$unique_name')";
$run = mysqli_query($conn, $qry);
if ($run === true) {
echo "<script>alert('Service Category added successfully.');</script>";
} else {
echo "<script>alert('Database Error: " . mysqli_error($conn) . "');</script>";
}
} else {
echo "<script>alert('Failed to upload image file.');</script>";
}
}
}
?>
<div class="content-wrapper">
<div class="container">
<h2>Add Service Category</h2>
<form action="" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="category">Services Category</label>
<input type="text" class="form-control" name="category" placeholder="Enter Services Category" required>
</div>
<div class="form-group">
<label for="category_ar">Services Category in Arabic</label>
<input type="text" class="form-control" name="category_ar" placeholder="Enter Category in Arabic" required>
</div>
<div class="form-group">
<label for="gallery">Image Gallery</label>
<input type="file" class="form-control-file border" name="gallery" required>
</div>
<input type="submit" name="Upload" value="Upload" class="btn btn-primary">
</form>
</div>
</div>
<!-- / Content -->
<!-- Footer -->
<footer class="content-footer footer bg-footer-theme">
<div class="container-xxl d-flex flex-wrap justify-content-between py-2 flex-md-row flex-column">
<!-- <div class="mb-2 mb-md-0">
©
<script>
document.write(new Date().getFullYear());
</script>
, made with ❤️ by
<a href="https://themeselection.com" target="_blank" class="footer-link fw-bolder">ThemeSelection</a>
</div> -->
<!-- <div>
<a href="https://themeselection.com/license/" class="footer-link me-4" target="_blank">License</a>
<a href="https://themeselection.com/" target="_blank" class="footer-link me-4">More Themes</a>
<a
href="https://themeselection.com/demo/sneat-bootstrap-html-admin-template/documentation/"
target="_blank"
class="footer-link me-4"
>Documentation</a
>
<a
href="https://github.com/themeselection/sneat-html-admin-template-free/issues"
target="_blank"
class="footer-link me-4"
>Support</a
>
</div> -->
</div>
</footer>
<!-- / Footer -->
<div class="content-backdrop fade"></div>
</div>
<!-- Content wrapper -->
</div>
<!-- / Layout page -->
</div>
</div>
<!-- / Layout wrapper -->
<!-- Core JS -->
<!-- build:js assets/vendor/js/core.js -->
<script src="../assets/vendor/libs/jquery/jquery.js"></script>
<script src="../assets/vendor/libs/popper/popper.js"></script>
<script src="../assets/vendor/js/bootstrap.js"></script>
<script src="../assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.js"></script>
<script src="../assets/vendor/js/menu.js"></script>
<!-- endbuild -->
<!-- Vendors JS -->
<!-- Main JS -->
<script src="../assets/js/main.js"></script>
<!-- Page JS -->
<!-- Place this tag in your head or just before your close body tag. -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
</body>
</html>