Results 1 to 2 of 2
Jul 12, 2009, 10:07 #1
insert into the database after downloading an file
I am providing the users to download a file. I wants to have user log for downloading the file.
I want that if an user really download the file then it should enter in the database. Below is the code i am using.
$file = strip_tags($_GET['q']);
// Quick check to verify that the file exists
if( !file_exists($file) ) die("File not found");
// Force the download
header("Content-Disposition: attachment; filename=\"" . basename($file) . "\"");
header("Content-Length: " . filesize($file));
//INSERT INTO DATABASE
Currently when someone clicks on the file it saves in the database instantly insead of actual download.