Fórum Abrir, baixar arquivo PDF #528555
12/08/2015
0
Estou tentando abrir ou baixar um arquivo .pdf utilizando o PHP, se puderem me ajudar informando aonde estou errando, agradeço!
Meu controller.php
<?php
$array = array("12345" => "bb0115_edital.pdf");
$titulo = "Aula 17 - Download de arquivo";
$idarquivo = $_GET['id'];
header("content-type:application/pdf");
header("Content-Dispositon:attachment;filename='bb0115_edital.pdf'");
readfile("../arquivos/".$array[$idarquivo]."bb0115_edital.pdf");
index
<?php
require_once("controller.php");
require_once("view.php");view
<html> <head> <title><?=$titulo?></title> </head> <body> <h1>Aguarde, seu download iniciará em breve...</h1> </body> </html>
Karine Sobral
Curtir tópico
+ 0Posts
13/08/2015
Karine Sobral
Gostei + 0
17/08/2015
Karine Sobral
Gostei + 0
18/08/2015
Jothaz
Na index não estaria faltando fechar a tag PHP?
<?php
require_once("controller.php");
require_once("view.php");
?>
Gostei + 0
18/08/2015
Karine Sobral
Gostei + 0
18/08/2015
Jothaz
Tente forçar a exibição de erros:
ini_set('display_errors',1);
ini_set('display_startup_erros',1);
error_reporting(E_ALL);
Gostei + 0
22/08/2015
Karine Sobral
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)