On the web page with the link to the file, create the php tag:
a href='download.php?name=myfile.mp3
&path=music/myfile.mp3'
Second, create the file download.php:
// get variables
$saveName = stripslashes($_GET["name"]);
$savePath = stripslashes($_GET["path"]);
// send headers to initiate a binary download
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$saveName");
header("Content-Transfer-Encoding: binary");
header("Content-length: " . filesize($savePath));
// read file
readfile($savePath);
?>
Arun Rama Balan.G is Tech Lead of Zerosoft Technologies, Thooththukudi. I had received a bachelor degree in computer science from SBK College - Aruppukottai and Masters degree in Computer Application from VHNSN College - Virudhunagar. I found these below solutions from GOOGLE SEARCH. So I update this solutions from Out side sources. Not My OWN Contents. Credit goes to Original authors..
Showing posts with label download. Show all posts
Showing posts with label download. Show all posts
Friday, August 21, 2009
Subscribe to:
Posts (Atom)