kohjhjhصثقص5572lllllllldfgddfgصثقffgggfffgfgfgdfgdg
Ele57885fddfg872llll82ddfgdfgdfgdfgdfgfgfggffggfgfgfghgقفغفغفقhfg555434536
/
home3
/
oraclepublicscho
/
public_html
/
Oracle_Cpanel
/
Upload FileeE
HOME
<?php include 'header.php'; include 'config.php'; ?> <?php $id = $_GET['id']; $com_qry = "SELECT * from gal WHERE id = '$id'"; $com_res = mysqli_query($connect,$com_qry); if(mysqli_num_rows($com_res) > 0 ) { $com_data = mysqli_fetch_assoc($com_res); } ?> <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <main id="main" class="main"> <div class="pagetitle"> <h1>Photo Gallery</h1> <nav> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="index">Home</a></li> <li class="breadcrumb-item">Photo Gallery</li> </ol> </nav> </div><!-- End Page Title --> <section class="section"> <div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-body"> <h5 class="card-title">Update Photo Gallery</h5> <?php if(isset($_POST['submit'])) { $id = $_GET['id']; $target_dir = "images/gallery/"; $target_file = $target_dir . strtolower(basename($_FILES["image"]["name"])); $allowed = array("image/jpeg", "image/gif", "image/png", "image/jfif"); if (!in_array($target_file, $allowed)) { $error_message = 'Only jpg, gif,jfif, and png files are allowed.'; if (isset($_FILES['image']['errors']) == 1) { echo "Sorry, your file was not uploaded."; } else { move_uploaded_file($_FILES["image"]["tmp_name"], $target_file); $co_qery = "UPDATE gal set image = '$target_file' WHERE id = '$id'"; $co_res = mysqli_query($connect,$co_qery); if($co_res) { ?> <script> alert('Updated Successfully'); window.location.replace("edit_gal?id=<?php echo $com_data['id'];?>"); </script> <?php } else { ?> <script> alert('Not Updated'); window.location.replace("edit_gal?id=<?php echo $com_data['id'];?>"); </script> <?php } } } } ?> <!-- Vertical Form --> <form class="row g-3" method="post" enctype="multipart/form-data"> <div class="col-12"> <label for="inputNanme4" class="form-label">Images</label> <input type="file" name="image" class="form-control" accept="image/jpg, image/jpeg, image/png,image/jfif" id="imageUpload" onchange="return fileValidation(this)" required> </div> <div class="col-12"> <img src="<?php echo $com_data['image'];?>" height="300" width="300"> </div> <div class="text-left"> <button type="submit" name="submit" class="btn btn-primary">Update</button> </div> </form><!-- Vertical Form --> </div> </div> </div> </div> </section> </main><!-- End #main --> <a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a> <script src="//cdn.ckeditor.com/4.9.2/standard/ckeditor.js"></script> <script type="text/javascript"> CKEDITOR.replace('descp'); </script> <!-- Vendor JS Files --> <script> function ConfirmDelete() { return confirm("Are you sure you want to delete?"); } </script> <script src="assets/vendor/apexcharts/apexcharts.min.js"></script> <script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="assets/vendor/chart.js/chart.umd.js"></script> <script src="assets/vendor/echarts/echarts.min.js"></script> <script src="assets/vendor/quill/quill.min.js"></script> <script src="assets/vendor/simple-datatables/simple-datatables.js"></script> <script src="assets/vendor/tinymce/tinymce.min.js"></script> <script src="assets/vendor/php-email-form/validate.js"></script> <!-- Template Main JS File --> <script src="assets/js/main.js"></script> </body> </html>