D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
antlerworldwide
/
public_html
/
admin
/
Filename :
frimage_edit.php
back
Copy
<?php include('checklogin.php')?> <?php include('include/header.php')?> <!--// top-bar --> <!-- Forms content --> <section class="forms-section"> <?php include('include/conectdb.php'); $error=''; $pid=$_GET['id']; if(isset($_POST['gallery'])) { if(empty($error)) { $target = "upload/"; $home_image=$_FILES['uploaded']['name']; $target = $target . basename($_FILES['uploaded']['name']) ; $ok=1; //This is our size condition if($home_image!='') { $res=mysqli_query($dbc,"SELECT `tlb_image` FROM `frimage` WHERE `id`=$pid"); $row=mysqli_fetch_array($res); // if ($home_image > 350000) // { // echo "Your file is too large.<br>"; // $ok=0; // } //This is our limit file type condition if ($home_image =="text/php") { echo "No PHP files<br>"; $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0) { echo "Sorry your file was not uploaded"; } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { $sql=mysqli_query($dbc,"UPDATE `frimage` SET `tlb_image`='$home_image' WHERE `id`='$pid'"); if($row['trr_urld']) { unlink('upload/'.$row[0]); } else { echo ''; } if($sql) { echo '<span class="successmssg">Project Details Succeessfully Updated. <a href="frimage.php" class="btn btn-primary">Click here to continue</a></span>'; exit(); } else { echo 'Database Problem'; } } else { echo "Sorry, there was a problem uploading your file."; } } } /* else { $sql=mysqli_query("UPDATE `gallery_image` SET `request_id`='$name WHERE `id`=$pid"); echo '<span class="successmssg">Project Details Succeessfully Updated, <a href="gall.php" class="btn btn-primary">Click here to continue</a></span>'; exit(); } */ } } else { $sql=mysqli_query($dbc,"SELECT * FROM `frimage` WHERE `id`='$pid'"); if(mysqli_num_rows($sql)==1) { $row=mysqli_fetch_array($sql); mysqli_free_result($sql); } else { echo'<span class="warn">Sorry no such Content exists.</span>'; exit(); } } ?> <div class="outer-w3-agile mt-3"> <h4 class="tittle-w3-agileits mb-4">Edit Detail</h4> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class=" table-responsive"> <form action="" method="post" enctype="multipart/form-data"> <div class="form-row"> <div class="form-group col-md-6"> <div class="form-group col-md-6"> <label for="inputCity">Photo</label> <div class="row"> <div class="col-md-8"><input type="file" name="uploaded" class="form-control" accept="image/*" onchange="loadFile(event)"></div> <div class="col-md-4 text-right"><img src="upload/<?=$row['tlb_image'];?>" class="img-preview" id="output"></div> </div> </div> <div class="form-group col-md-12 text-center mt-4"> <button type="submit" name="gallery" id="vchangeProfile" class="btn btn-primary" data-dismiss="modal" aria-hidden="true" title="submit">Update</button> <!--<button type="submit" name="vchangeProfile" id="vchangeProfile" class="btn btn-primary" data-dismiss="modal" aria-hidden="true" title="cancel">Cancel</button>--> <a href="frimage.php" class="btn btn-primary" data-dismiss="modal" aria-hidden="true" title="cancel">Cancel</a> </div> </form> </div> </div> </div> </section> <!--// Forms content --> <?php include('include/footer.php') ?>