Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require("dbconnect.inc.php");
- $qry = "SELECT protocolo,nomeBoleto,categoria,hr_dt_inserido FROM boletos";
- $res = mysqli_query($con, $qry);
- while($fila = mysqli_fetch_array($res))
- {
- print "$fila[protocolo]
- <br>
- $fila[nomeBoleto] ($fila[categoria])
- <br>
- <a href='baixar_arquivo.php?protocolo=$fila[protocolo]'>Fazer Download</a>
- <br>
- ";}
- ?>
- <?php
- require("dbconnect.inc.php");
- require("listar_arquivos.php");
- $protocolo= $_GET['protocolo'];
- $sql = "SELECT nomeBoleto, boleto FROM boletos WHERE protocolo='".$protocolo."'";
- $result = mysqli_query($con, $sql);
- if(mysqli_num_rows ($result) > 0 ){
- while($registro = mysqli_fetch_assoc($result)){
- $FILENAME =$registro['nomeBoleto'];
- $SFILEPATH = $registro['boleto'];
- header("Content-Disposition: attachment; filename={$FILENAME}");
- header("Content-Transfer-Encoding: binary");
- header('Expires: 0');
- header('Pragma: no-cache');
- // Envia o arquivo para o cliente
- readfile($FILEPATH);
- }
- }
- else{
- print "Não existe arquivos a serem baixados";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement