I have a directory inside my server full of PDF files and I would like to open the file and be able to click on the name of the PDF and watch its content. Now I only get the names of the files in a list but thats all. I would like to press in the name and open the PDF.
<?php 
$sub = ($_GET['dir']); 
$path = 'pedidos/'; 
$path = $path . "$sub"; 
$dh = opendir($path); 
$i=1; 
while (($file = readdir($dh)) !==   false) {
  if($file != "." && $file != "..") {
      if (substr($file, -4, -3) =="."){
          echo "$i. $file <br />";
      }else{                  
          echo "$i. <a href='?dir=$sub/$file'>$file</a><br />";
      }
      $i++;
   } } 
closedir($dh); ?>
 
     
     
    