<?php ob_start(); session_start(); include_once('../connect.php'); if(!isset($_SESSION['username'])) { header('location:login.php'); } ?> <!DOCTYPE html> <html> <title>PCC</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script> <body> <?php include_once("edit_menu.php"); ?> <div class="container-fluid"> <p class="well"> <div class="row"> <div class="col-md-12"> <form action="" method="post" enctype="multipart/form-data"> <table class="table-condensed table-striped" style="width: 100%;"> <tr> <td><input type="file" name="file" multiple="" /></td> <td><input type="submit" class="btn btn-info" name="submit" value="upload"></td> </tr> </table> </form> </p> </div> </div> <h4 class="well" style='font-weight:bold;'>Upload Learning Notes </h4> <div class="row"> <?php $notebook = glob("../notes/*"); foreach($notebook as $notes) { echo '<div class="col-md-2"> <embed src="'.$notes.'" style="width:200px;height:200px"> <br> <a class="btn-danger" href="notes.php?delx='.$notes.'" id="del">Delete</a> </div>'; } ?> </div> </div> <?php if(isset($_POST["submit"])) { $id= $_POST['id']; $file=$_FILES["file"]["name"]; $tmp_name=$_FILES["file"]["tmp_name"]; $path="../notes/".$file; move_uploaded_file($tmp_name,$path); //if(mysqli_query($db,"insert into test_series (file) values ('$file')")) header ("location:notes.php"); } ?> <?php if(isset($_GET['delx'])) { $x = $_GET['delx']; // $sql = mysqli_query($db,"delete from test_series where id = '$x'"); unlink($x); header("location:notes.php"); } ?>