I have an upload form
documents are uploaded to an (Uploads/Reference/) folder and a link to document is stored in mysql database like this:
$sql="INSERT INTO uploaddate (upload_id, file_link)
VALUES
('$upload_id', '$target')";
the link stored in ‘file_link’ column of ‘uploaddata’ table is like this:
(Uploads/Reference/6206webhost change.txt)
Now when i run a select statement to this table, instead of just displaying plain text extension i would like to get a clickable link which can be used to download the uploaded document from it’s location.
How can i do this?
You could do this: when you render page using PHP, create a link
<a href="/download.php?id=doc_id">Download</a>.Then in a new page called download.php get document id, read filename from db using that doc_id and send that file out so user can download it…
EDITED:
$_GET['id']you get doc_id: be careful, check if value really exists and sanitize itSELECT file_link FROM uploaddate WHERE upload_id = doc_id;I write the example from other post, but check that to get alla informations: