Dowload blobs from Database
I know this is not the best way to store files but I have inherited an old php script which I am converting to CF because php is useless.
Now i have a script to do this in php but can this be achived with CF? It is just a quick fix until I have time to rework the CMS
<?php
if(isset($_GET['id']))
{
// if id is set then get the file with the id from database
$id = $_GET['id'];
$query = "SELECT name, type, size, content " .
"FROM upload WHERE id = '$id'";
$result = mysql_query($query) or die('Error, query failed');
list($name, $type, $size, $content) = mysql_fetch_array($result);
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$name");
echo $content;
i
exit;
}
?>
