Hi everyone!
I'm new to the board and relatively new to php. I'm trying to setup my website to use php and mysql and I'm having a little trouble. I've got almost everything working at the moment except for creating download links. I want users, regular users from the internet who are not registered etc., to be able to download a sample file from my website. The sample file is a microsoft excel file 2003 or 2007; the file is stored in a blob type field in my mysql database. I've got the file uploaded and everything up to there working. The problem is that I am not sure how to create a download link to this excel file. I want it to be a dynamic download link, since there will be many excel files, which, when clicked, will open the download link to get the file.
So, my problem is that I don't know how to create this link.
I know that I need headers, something like this:
Code: Select all
header("Content-type: application/vnd.ms-excel");
header("Cache-Control: no-cacher, must-revalidate");
header("Expires: Sat, 13 May 1991 01:00:00 GMT");Code: Select all
<?php
// open the file in a binary mode
$name = '$row['excelfilel']';
$fp = fopen($name, 'rb');
// dump the picture and stop the script
fpassthru($fp);
exit;
?>But, I'm really not sure how to make this work. Any help in creating this download link to an excel file contained in a blob field in mysql would be greatly appreciated. I'm sure this is probably really easy to do; thanks for your time!