Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE boletos (
- protocolo int(11) NOT NULL AUTO_INCREMENT,
- boleto mediumblob NOT NULL,
- nomeBoleto varchar(20) DEFAULT NULL,
- tipoBoleto varchar(20) DEFAULT NULL,
- PRIMARY KEY (protocolo));
- <?php
- include "config.php";
- // Define o tempo máximo de execução em 0 para as conexões lentas
- set_time_limit(100);
- $GerParam=filter_input(INPUT_GET, "protocolo" ,FILTER_DEFAULT);
- if(isset($_GET['protocolo'])){
- $protocolo = $_GET['protocolo'];
- $stat = $db->prepare("SELECT nomeBoleto,tipoBoleto,boleto FROM boletos WHERE protocolo=?");
- $stat->execute(array($_GET['protocolo']));
- $stat->bindColumn(1, $nomeBoleto, PDO::PARAM_STR, 256);
- $stat->bindColumn(2, $tipoBoleto, PDO::PARAM_STR, 256);
- $stat->bindColumn(3, $boleto, PDO::PARAM_LOB);
- $stat->fetch(PDO::FETCH_BOUND);
- header('Accept-Ranges: bytes');
- header('Content-Transfer-Encoding: binary');
- header("Content-Type: $tipoBoleto");
- header("Content-Disposition: attachment; filename=$nomeBoleto");
- echo $boleto;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement