Dear All,
AT last, with the great support of Bob et al, I am on the final leg of my journey :-)
My form now successfully uploads images/pdfs/other file types directly into the database. I am now working on the retrieval of the same. I have established a CC to the database table and for test purposes set up a VERY simple table to display a link to the image/pdf etc. The link looks something like this
You can see that this ref is passing an ID number from each record to the download.php file...
What I am not sure of is a. how to get the id for the href link in the first place? And b. the correct syntax to construct the href with the returned ID so that I can pass it on to the download.php file.
It has taken me a while to get this far and I couldn't have done it without the support I have received. Many thanks to everyone for that - it is greatly appreciated.
Best Regards
Chris
AT last, with the great support of Bob et al, I am on the final leg of my journey :-)
My form now successfully uploads images/pdfs/other file types directly into the database. I am now working on the retrieval of the same. I have established a CC to the database table and for test purposes set up a VERY simple table to display a link to the image/pdf etc. The link looks something like this
<a href="downloadfile.php?Id=<?php echo $row["Id"]; ?>">
You can see that this ref is passing an ID number from each record to the download.php file...
<?php
global $Id;
if(!is_numeric($Id))
die("Invalid Id specified");
$sConn = mysql_connect($dbServer, $dbUser, $dbPass) or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn) or die("Couldn't connect to database $dbDatabase");
$dbQuery = "SELECT blobType, blobData ";
$dbQuery .= "FROM my_table ";
$dbQuery .= "WHERE Id = $Id";
$result = mysql_query($dbQuery) or die("Couldn't get file list");
if(mysql_num_rows($result) == 1)
{
$fileType = @mysql_result($result, 0, "blobType");
$fileContent = @mysql_result($result, 0, "blobData");
header("Content-type: $fileType");
echo $fileContent;
}
else
{
echo "Record doesn't exist.";
}
?>
What I am not sure of is a. how to get the id for the href link in the first place? And b. the correct syntax to construct the href with the returned ID so that I can pass it on to the download.php file.
It has taken me a while to get this far and I couldn't have done it without the support I have received. Many thanks to everyone for that - it is greatly appreciated.
Best Regards
Chris