Código PHP:
<?php
if(isset($_REQUEST['Ficha']))
{
require_once('Connections/guardia.php');
$dbconn = mysql_connect($hostname_guardia, $username_guardia, $password_guardia) or die("Error Occurred-".mysql_error());
mysql_select_db($database_guardia, $guardia) or die("Unable to select database");
$id = $_REQUEST['Ficha'];
$query = "SELECT img_name, img_type, img_size, img_data FROM img_tbl WHERE Ficha = $id";
$result = mysql_query($query, $guardia) or die(" " . $query . mysql_error());
$contenido =($content);
list($name, $type, $size, $contenido) = mysql_fetch_array($result);
header('Content-length: "'.$size.'"');
header('Content-type: $type');
print $contenido;
mysql_close($guardia);
}
?>