...

View Full Version : downloading a file



GO ILLINI
01-04-2006, 01:41 AM
I know there is the way by changing the headers to the filename or something like that but Im pretty sure that changes the page to that file doesnt it? I have a download page and would like to be able to popup a download or something instead of doing it in the main page. I made a js for it but then remembered i dont want the whole world to see the path so now i am back to php to save me.
I will post my js if that would help anyone better understand what i mean.

Thanks,
ILLINI

Yusayoh
01-04-2006, 01:58 AM
Let me get this straight: You want a download page that popups (alert in javascript) and automatically downloads something? Like, for example, you click index.php?id=5 and it goes there, then goes to the place of the download (EX: http://fake.com/download/file.rar). Am I getting this right?

GO ILLINI
01-04-2006, 02:01 AM
no I have a page index.php?f=name and have stuff on that page like counters and stuff... I want it to NEVER leave that page. Just download the file from there so that index.php is still what they can see.

Yusayoh
01-04-2006, 02:10 AM
If it redirected to the fake link i gave, then the download screen should popup asking if you want to open or save the file.

brotherhewd
01-04-2006, 02:12 AM
Let me get this straight: You want a download page that popups (alert in javascript) and automatically downloads something? Like, for example, you click index.php?id=5 and it goes there, then goes to the place of the download (EX: http://fake.com/download/file.rar). Am I getting this right?

how would you do that?

Yusayoh
01-04-2006, 02:16 AM
Like you click a link, goes to index.php?id=5 and refreshes on the download link (httx://fakity.com/file.rar) which will automatically start the download while staying on index.php?id=5.

brotherhewd
01-04-2006, 02:18 AM
Do you have a php script written for this action? (that is what i meant in my first post, sorry about the misunderstanding)

Yusayoh
01-04-2006, 02:25 AM
Example:

<?php
//This is the main index page
$id = $_GET['id'];
if ($id) {
print "You're on the download page. Currently executing and getting download.";
print "<meta http-equiv=refresh content=2;url=http://fake.com/$id.rar>";
exit;
}
print "<a href=index.php?id=5>Click here</a>";
?>

GO ILLINI
01-04-2006, 02:29 AM
<html>
<head>
<title>Download</title>



</head>
<body>
<h2>Downloads</h2>

<?php
if($f=="ktc1-0") {
$file = "ktc1.0";
$name = "Kill the Clown 1.0";
include("count.php");
}
if($f=="ktcnew") {
$file = "ktcnew";
$name = "Kill the Clown newest";
include("count.php");
}
else {
echo("Im sorry there was some sort of error with the download<br>");
}
?>
Is my code right now could someone make that with a download in it.
$file is for the counter
and
$name is for the echo that will be on the page in a <h1>
$f is index?f=fname

brotherhewd
01-05-2006, 12:12 AM
Example:

<?php
//This is the main index page
$id = $_GET['id'];
if ($id) {
print "You're on the download page. Currently executing and getting download.";
print "<meta http-equiv=refresh content=2;url=http://fake.com/$id.rar>";
exit;
}
print "<a href=index.php?id=5>Click here</a>";
?>

I have download template page that shows up for every download, is there a way to integrate your script in that.

GO ILLINI
01-05-2006, 03:06 AM
I used javascript echoed out through php. Open up a new window(the filename) but does anyone know how to close a window? ill show you what i mean...:

if($f=="ktc1-0") {
$file = "ktc1.0";
$name = "Kill the Clown 1.0";
include("count.php");
echo "<script>";
echo "window.open('Kill_the_Clown_setup_ver1.0.exe');";
//SCRIPT TO CLOSE THE OTHER WINDOW THAT JUST OPENED
echo "</script>";
}

brotherhewd
01-05-2006, 03:10 AM
thanks for the tip illini



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum