After much testing, this is the combination that I came up with and it has worked in all my projects ever since.
Program to handle download requests
<?php
// Do all neccessary security checks etc to make sure the user is allowed to download the file, etc..
//
$file = '/path/to/your/storage/directory' . 'the_stored_filename';
$filesize = filesize($file);
header('Content-Description: File Transfer');
header("Content-type: application/forcedownload");
header("Content-disposition: attachment; filename=\"filename_to_display.example\"");
header("Content-Transfer-Encoding: Binary");
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header("Content-length: ".$filesize);
ob_clean();
flush();
readfile("$file");
exit;
EDIT
The above code would go into it's own file, for example 'download.php'. Then you would change the download link on your other page to something like:
<a href="download.php?filename=<?php echo $test_name; ?>">Download File</a>
You will also need to modify the php code above so that it works in your situation. In the example I just gave you would want to change this line:
$file = '/path/to/your/storage/directory' . 'the_stored_filename';
To this:
$file = $_get['filename'];
would work at a most basic level. You would want to sanitize the value of $_get['filename'] before just blindly using it in any production environment.
If you want to present the download in the same page that the user is requesting it from then look at my answer to this post: Dowloading multiple PDF files from javascript