Server IP : 2a02:4780:3:1493:0:3736:a38e:7 / Your IP : 216.73.216.139 Web Server : LiteSpeed System : Linux sg-nme-web1393.main-hosting.eu 4.18.0-553.40.1.lve.el8.x86_64 #1 SMP Wed Feb 12 18:54:57 UTC 2025 x86_64 User : u926327694 ( 926327694) PHP Version : 7.4.33 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u926327694/domains/smsoft.in/public_html/demo/src/../update/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php include "config/config.php"; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $Section=$_POST["Section"]; $Head1=$_POST["Head1"]; $Head2=$_POST["Head2"]; $Head3=$_POST["Head3"]; mysqli_query($con,"INSERT INTO `Receipt_Head` (`ID`, `Section`, `Head1`, `Head2`, `Head3`) VALUES (NULL, '$Section', '$Head1', '$Head2', '$Head3')"); ?> <?php // /home/username/domains/yourdomain.tld/public_html //$target_dir = "/home/u926327694/domains/smsoft.in/public_html/".$code."/school_logos/"; $target_dir = "school_logos/"; $fileinfo=PATHINFO($_FILES["image"]["name"]); $schoolcode=$_SESSION['code']; $newFilename="logo_".$schoolcode.".jpg"; //$code."-".rand()."." . $fileinfo['extension']; $target_file = $target_dir . $newFilename; // exit(); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); // Check if image file is a actual image or fake image if(isset($_POST["image"])) { $check = getimagesize($_FILES["image"]["tmp_name"]); if($check !== false) { // echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } // Check if file already exists // Check file size // Allow certain file formats // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { //unlink($target_file); //echo"Done"; exit; if($_FILES["image"]["name"]!="") { if (move_uploaded_file($_FILES["image"]["tmp_name"], $target_file)) { /*echo "The file ". basename( $_FILES["image"]["name"]). " has been uploaded.";*/ $url_path=$burl.'/'.$newFilename; $sql="UPDATE `schools` SET `logo` = '$url_path' WHERE `schools`.`schoolCode` = '$code'"; if(mysqli_query($rootcon,$sql)){ ?> <script> alert("Receipt Name Has been Created"); document.location="Receipt_head_create.php"; </script><?php }else{ ?> <script> alert("<?= mysqli_error($rootcon) ?>"); document.location="Receipt_head_create.php"; </script><?php } } else { //echo "Sorry, there was an error uploading your file.".$_FILES["image"]["error"]; ?> <script> alert("Sorry, there was an error uploading your file."); document.location="Receipt_head_create.php"; </script><?php } } else { $sql="UPDATE `schools` SET `logo` = '$target_file' WHERE `schools`.`schoolCode` = '$code'"; if(mysqli_query($rootcon,$sql)){ ?> <script> alert("Receipt Name Has been Created"); document.location="Receipt_head_create.php"; </script><?php }else{ ?> <script> alert("<?= mysqli_error($rootcon) ?>"); document.location="Receipt_head_create.php"; </script><?php } } } } ?>