View documents in . PDF in different folders

Asked

Viewed 192 times

0

Good morning! I have a panel where is posted multiple PDF files, however are 3 different folders according to each file type. And in this panel, I need to put a method where the person can view the file. However, I don’t know how to do this search in different folders.

Follow the code snippet that lists the files:

    </tr>
    <?
      $sql = "SELECT * FROM `pdf`";
      $query = mysqli_query($conectar, $sql);
      //var_dump($resultado);exit;
      while($listar = mysqli_fetch_assoc($query)){
    ?> 
        <tr>
          <td><?=$listar["nome"]?></td>
          <td><?if($listar["tipo"] == 1)echo"Licitações";
                if($listar["tipo"] == 2)echo"Edital";
                if($listar["tipo"] == 3)echo"Legislação";?></td>
          <td><a href="" class="btn btn-default" target="_blank">
                <span class="glyphicon glyphicon-download"></span> Download</td>
          <td><a href="" class="btn btn-default btn-sm help" data-toggle="modal" title="Excluir PDF"><span class="glyphicon glyphicon-trash"></span></a></td>
        </tr>    
      <?}?> 

As you can see, there is the Uploads folder, and within it legislation, bids and edicts. Where is each file type. While listing, I put to download the file but do not know how to search this file in different folders.

  • You want to download the file from the database or from a directory?

  • I want to download from a directory

  • https://wiki.locaweb.com.br/pt-br/PHP_-_Download_de_arquivos

  • This should help you. Instead of span you can use a link that points to the uploads/bidding/filename.pdf directory.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.