File Download MySQL Blob

4

I need to download a .xls file that is in a MySQL database, but I need to save it with the original name.

Can anyone help me?

Uploading with you can be easy. I need to download it.

include_once 'db.php';
$download = mysql_query("SELECT formResolucao FROM tbconfiguracoes");
$nome = mysql_result($download, 0, "nome");
$tipo = mysql_result($download, 0, "tipo");
$conteudo = mysql_result($download, 0, "conteudo");

header('Content-Type: text/html; charset=utf-8');
header('Content-Type: filesize($conteudo)');
header('Content-Type: $tipo');
header("Content-Disposition: attachment; filename=$nome"); 
    
asked by anonymous 05.12.2014 / 17:21

1 answer

1

The php file has to look like this:

include_once 'db.php';
$download = mysql_query("SELECT formResolucao FROM tbconfiguracoes");
$nome = mysql_result($download, 0, "nome");
$tipo = mysql_result($download, 0, "tipo");
$conteudo = mysql_result($download, 0, "conteudo");

header("Content-type: application/vnd.ms-excel; name='excel'");

header("Content-Disposition: filename=".$nome.".xls");

header("Pragma: no-cache");



echo $conteudo;
    
10.09.2015 / 18:51