View in browser pdf file with url in database

-2

Hello! I have an application that uploads the PDF file whose url is saved in the database and the file in a folder. By clicking the view button the pdf file opens in the browser.

<a href="view.php?id= NÃO SEI O QUE COLOCAR AQUI"><button type="button" class="button btn btn-link">View</button></a>

This is my view.php:

  <?php
      header('Content-type: application/pdf');
      echo $row['arquivo']; 
  ?>    

I do not know what to do. Can anyone help me?

    
asked by anonymous 21.06.2017 / 00:48

2 answers

0

It's doing a bit of confusion in the code.

Your link should open a URL like this:

link

On your view.php view page:

$pdf_id= $_REQUEST['pdf_id']; 
AQUI VAI A CONSULTA SQL para recuperar URL e arquivo.
    
21.06.2017 / 01:37
0

Hello. In case, my view.php file would look like this? :

<?php
  $pdf_id = $_REQUEST['arquivo'];

  header('Content-type: application/pdf');
  echo $pdf_id;
?>

And my button how would it look?

<a href="view.php?id= COMO FICARIA AQUI "><button type="button" class="button btn btn-link">View</button></a>
    
21.06.2017 / 01:50