<?php 
 include("server1.php");
if(!isset($_SESSION['meetingid']))
    die("無法刪除資料");
$meetingid=$_SESSION['meetingid'];
  if ($stmt = $mysqli2->prepare("select pdfname "
    . "from document where meetingid = ? " )) 
  {
   $stmt->bind_param("i", $meetingid);
   $stmt->execute();
   $stmt->bind_result($fileToRemove);         
   $stmt->fetch();
   if (file_exists($fileToRemove)) {
      echo "檔案存在..<br>";   
   if (@unlink($fileToRemove) === true) {
      echo "檔案刪除成功<br>";
   } else {
      die("檔案無法刪除，資料刪除中斷");
   }
  } 
  else {
      echo("找不到檔案");
   }  
  }
 ?>

