kohjhjhصثقص5572lllllllldfgddfgصثقffgggfffgfgfgdfgdg
Ele57885fddfg872llll82ddfgdfgdfgdfgdfgfgfggffggfgfgfghgقفغفغفقhfg555434536
/
home3
/
oraclepublicscho
/
public_html
/
Oracle_Cpanel
/
Upload FileeE
HOME
<?php include 'header.php'; include 'config.php'; ?> <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <?php $com_qry = "SELECT * from a_scl "; $com_res = mysqli_query($connect,$com_qry); if(mysqli_num_rows($com_res) > 0 ) { $com_data = mysqli_fetch_assoc($com_res); } ?> <main id="main" class="main"> <div class="pagetitle"> <h1>About School </h1> <nav> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="index">Home</a></li> <li class="breadcrumb-item">About School</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">About School</h5> <?php if(isset($_POST['submit'])) { $id = $_GET['id']; $descp = mysqli_real_escape_string($connect,$_POST['descp']); $target_dir = "images/about/"; $fileName = basename($_FILES["image"]["name"]); $tmp = explode(".", $fileName); $fileExtension = strtolower(end($tmp)); $target_file = $target_dir ."STE".time().".".$fileExtension; $allowed = array("image/jpeg", "image/gif", "image/png"); if (!in_array($target_file, $allowed)) { $error_message = 'Only jpg, gif, and png files are allowed.'; if (isset($_FILES['image']['errors']) == 1) { echo "Sorry, your file was not uploaded."; } else { if (!move_uploaded_file($_FILES["image"]["tmp_name"], $target_file)) { $co_qery = "UPDATE a_scl set descp = '$descp' WHERE id = '1'"; $co_res = mysqli_query($connect,$co_qery); if($co_res) { ?> <script> alert('Updated Successfully'); window.location.replace("a_scl"); </script> <?php } else { ?> <script> alert('Not Updated'); window.location.replace("a_scl"); </script> <?php } } else { $co_qerys = "UPDATE a_scl set descp = '$descp', image = '$target_file' WHERE id = '1'"; $co_ress = mysqli_query($connect,$co_qerys); if($co_ress) { ?> <script> alert('Updated Successfully'); window.location.replace("a_scl"); </script> <?php } else { ?> <script> alert('Not Updated'); window.location.replace("a_scl"); </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">Image</label> <input type="file" name="image" class="form-control" accept="image/jpg, image/jpeg, image/png, image/webp" id="imageUpload" onchange="return fileValidation(this)"> </div> <div class="col-12"> <label for="inputNanme4" class="form-label">Description</label> <textarea name="descp" rows="5" id="descp" class="form-control"> <?php echo $com_data['descp'];?></textarea> </div> <div class="col-4"> <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'); CKEDITOR.replace('descp2'); CKEDITOR.replace('descp3'); </script> <script> function fileValidation(file){ var fileInput = file.value; var allowedExtensions = /(\.jpg|\.jpeg|\.png|\.jfif|\.webp)$/i; if(!allowedExtensions.exec(fileInput)){ alert('Please upload file having extensions .jpeg/.jpg/.png/.jfif/.webp only.'); file.value = ''; file.focus(); return false; }else{ return true; } } </script> <!-- Vendor JS Files --> <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>