<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problema download file dal database]]></title><description><![CDATA[<p dir="auto">Ciao a tutti, avrei un problema con script per il download dei file da una tabella del database.<br />
Questo script ho visto che va funziona con i vari tipi di file ma mi da un problema con i file compressi, ovvero mi dice File danneggiato o in un formato sconosciuto.</p>
<p dir="auto">Qualcuno saprebbe come aiutarmi?</p>
<p dir="auto">&lt;?php<br />
// Includo la connessione al database<br />
require('../config.php');</p>
<p dir="auto">if($_GET['id'] == "")<br />
header("Location: predownload.php");</p>
<p dir="auto">// Query per recuperare il file<br />
$query = "SELECT * FROM tabella_file WHERE id = " . $_GET["id"];<br />
$risultato = mysql_query($query)<br />
or die("Query non valida: " . mysql_error());<br />
$tmp = mysql_fetch_array($risultato);</p>
<pre><code>header('Content-Description: File Transfer'); 
header('Content-Transfer-Encoding: binary'); 
header("Content-Type: {$tmp['tipo']}"); 
header("Content-Disposition: attachment; filename={$tmp['nome']}"); 
header("Content-Length: {$tmp['size'] }"); 
header('Expires: 0'); 
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 
header('Pragma: public'); 


echo $tmp['dati']; 
</code></pre>
<p dir="auto">?&gt;</p>
]]></description><link>https://dev.connect.gt/topic/205821/problema-download-file-dal-database</link><generator>RSS for Node</generator><lastBuildDate>Fri, 27 Nov 2026 08:18:49 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/205821.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 11 Sep 2014 20:23:38 GMT</pubDate><ttl>60</ttl></channel></rss>