Summernote How To Delete Images Uploaded To A Folder

Uploads

Make sure that you create img-uploads folder on your server. This is where the images will go. Then you want to create the following script. The index file will use this for uploading your images.

<?php 
include_once('config.php');
if(empty($_FILES['file']))
{
  exit();	
}
$errorImgFile = "./img/img_upload_error.jpg";
$temp = explode(".", $_FILES["file"]["name"]);
$newfilename = round(microtime(true)) . '.' . end($temp);
$destinationFilePath = './img-uploads/'.$newfilename ;
if(!move_uploaded_file($_FILES['file']['tmp_name'], $destinationFilePath)){
  echo $errorImgFile;
}
else{
  echo $destinationFilePath;
  mysqli_query($con,"INSERT INTO uploads(`file`)
VALUES ('$destinationFilePath')");
}

?>

Entry File

Now create an entry.php file and put this code in it. This will list all the entries we have in the database.

<?php include_once('header.php'); ?>
<div class="container-fluid">
  <h1>Entires</h1>
<?php 
$ct=1;
$result = $con->query("SELECT id, date_time FROM entry") ;
while ($row = $result->fetch_assoc()) {
  echo '  <div class="row">
    <div class="col-sm-4">
      <p>'.$row['id'].'</p>
    </div>
    <div class="col-sm-4">
      <p>'.$row['date_time'].'</p>
    </div>
  <div class="col-sm-4">
      <p><a href="view.php?p='.$row['id'].'" class="btn btn-lg btn-success">View</a></p>
    </div>
  </div>
';
$ct++;
}
?>
</div>
<style>.row{border:solid #000 1px;}</style>
<?php include_once('footer.php'); ?>

Next we will create the view file.

Only cool people share!

Summernote How To Delete Images Uploaded To A Folder was last modified: February 25th, 2023 by Maximus Mccullough
Summary
Summernote How To Delete Images Uploaded To A Folder
Article Name
Summernote How To Delete Images Uploaded To A Folder
Description
In Summernote you want to be able to delete your images in your directory or folder at times. As far as I can see, this is the only tutorial out there on this, so I decided to do it.
Author
Publisher
A1WEBSITEPRO LLC
Logo
Summernote How To Delete Images Uploaded To A Folder

Pages:Previous 1 2 3 4 Next

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.