Click to See Complete Forum and Search --> : save target as...


metrosoccer12
08-01-2003, 03:28 PM
is there a code i can use to make it so when the user clicks a link it saves the target as instaed of doing the regualur action... if it cant be done in javascript can it be done in cgi or php?

pyro
08-01-2003, 05:03 PM
Here's the PHP version: http://www.infinitypages.com/research/download.htm

metrosoccer12
08-01-2003, 05:34 PM
nice works awsome man but my friend is hosting the things i want to be able to download how do i do that?

<?PHP

#######################################################
# This script is Copyright 2003, Infinity Web Design #
# Written by Ryan Brill - ryan@infinitypages.com #
# All Rights Reserved - Do not remove this notice #
#######################################################

$files = array("index.html","test2.txt");
$index = $_GET["index"];
$filename = $files[$index];

if (is_file($filename)) {
header("Content-type: application/octet-stream");
header("Content-Length: ".filesize($filename));
header("Content-Disposition: attachment; filename=\"".$filename."\"");

$fp = fopen($filename, 'rb');
fpassthru($fp);
fclose($fp);
}
else {
echo "File not available.";
}

?>

pyro
08-01-2003, 05:36 PM
You'd have to put the PHP on their server, and link to it that way...

metrosoccer12
08-01-2003, 05:38 PM
okay thanks! :)

pyro
08-01-2003, 05:44 PM
You're welcome... Enjoy :)

metrosoccer12
08-01-2003, 08:01 PM
oaky i have a problem it works fine for me, but some have my friends have tested it and said that it just plays the song in WMP that pops up on the side panel thing.. there running IE6 and so am i... anyone know why this is happening?

Bootsman123
08-02-2003, 06:18 AM
Then they have other settings than you do.