I have a table that has the following columns: recID,Name,Type,docData
docData is a BLOB type
Using Apache as my web server, my SQL as my database backend. I have the files getting uploaded into the database fine. I originally had it so the upload would place the file into a directory and place a reference into the SQL table. I know have decided to put the docData into a BLOB field. I have several reasons to do this.
My final task in the conversion is to have the ability to download this docData from a PHP script.
My original download script was the following
I am still trying to get used to PHP. I am unclear if this code can be reused to download BLOB data? I know I could probably save the BLOB to a temp file and then do the same script as I have but I would prefer not to do this.
$fname = $_GET['fname'];
$path = "./docData/".$fname;
$fullPath = $path.$_GET['download_file'];
$file = $path.$_GET['download_file'];
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename='.basename($file));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Length: ' . filesize($file));