Log in

View Full Version : Download Link



legofan4364j
01-04-2009, 12:02 AM
I want to make a website where you can submit downloadable files..... how can you hake a link to download it with HTML?

Is it even Possible with HTML?

legofan4364j
01-04-2009, 12:15 AM
Just Testing to see if it works:
(I found this on a diffrent site)

<?php
$file = 'Contest Entery.wmv';

if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>

Edit: Awww it didnt work..... =(

Nile
01-04-2009, 12:16 AM
It would not be possible with html alone. HTML is a very simple language and cannot be used for anything over graphics. In other words - it simply is just a language to create visual elements on the page and nothing else. You would need a server-side language such as PHP to accomplish this. A server-side language is in my mind "a language that works behind the seens." For some tutorials about PHP try the following.
http://www.tizag.com/phpT/
http://www.quackit.com/php/
http://www.w3schools.com/php/default.asp