Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts

    downloading a file

    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
    Why not thank me?

    http://adamsworld.name

  • #2
    New Coder
    Join Date
    Jan 2006
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    |||||||||||||||||||||||||||||||||

  • #3
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    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.
    Why not thank me?

    http://adamsworld.name

  • #4
    New Coder
    Join Date
    Jan 2006
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    |||||||||||||||||||||||||||||||||

  • #5
    New Coder
    Join Date
    Nov 2005
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Yusayoh
    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?
    www.XtraFile.com
    -Free OneClick File Hosting!

  • #6
    New Coder
    Join Date
    Jan 2006
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    |||||||||||||||||||||||||||||||||

  • #7
    New Coder
    Join Date
    Nov 2005
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you have a php script written for this action? (that is what i meant in my first post, sorry about the misunderstanding)
    www.XtraFile.com
    -Free OneClick File Hosting!

  • #8
    New Coder
    Join Date
    Jan 2006
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Example:
    PHP Code:
    <?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>";
    ?>
    |||||||||||||||||||||||||||||||||

  • #9
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    <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>
    Edit: $f is index?f=fname
    Last edited by GO ILLINI; 01-04-2006 at 03:42 AM.
    Why not thank me?

    http://adamsworld.name

  • #10
    New Coder
    Join Date
    Nov 2005
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Yusayoh
    Example:
    PHP Code:
    <?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.
    www.XtraFile.com
    -Free OneClick File Hosting!

  • #11
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    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...:
    Code:
    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>";
    }
    Why not thank me?

    http://adamsworld.name

  • #12
    New Coder
    Join Date
    Nov 2005
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the tip illini


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •