In PHP how do i go about creating a process like software download websites do.

So i click a download link and it brings up a page saying "Contacting download server, your download will begin shortly. if it doesn't >click here<"

And then the download requester open/save/cancel requester appears.

What is the steps to create the same thing in PHP?

My exact problem involves clicking a link which runs a function to generate a ZIP archive on the fly. whilst the zip archive is being made i'd like to show a message telling them to wait. once the archive is complete i'd then push it to the client to download somehow.

    Before the page starts to create the zip, you will need to output the "building zip, please wait..." because nothing will get outputed to the browser until PHP has finished.

    Then, after the zip is made, you can just redirect the browser to the file, which will cause for that download window to pop-up. Page could look comehting like this:

    <head>
    <body>

    <?
    function Default()
    {
    echo "please wait while the zip is created";
    all the commands to create the zip file
    echo "document.location.href='thispage.php?Director=Download';";
    }

    if ($_GET[Director] == "Download")
    {
    echo "document.location.href='location/of/zipfile.zip';";
    }
    else
    {
    Default();
    }

    </body>
    </head>

    Originally posted by budda
    In PHP how do i go about creating a process like software download websites do.

    So i click a download link and it brings up a page saying "Contacting download server, your download will begin shortly. if it doesn't >click here<"

    And then the download requester open/save/cancel requester appears.

    What is the steps to create the same thing in PHP?

    My exact problem involves clicking a link which runs a function to generate a ZIP archive on the fly. whilst the zip archive is being made i'd like to show a message telling them to wait. once the archive is complete i'd then push it to the client to download somehow.

      I messed up, would be more like this:

      Originally posted by kellog
      Before the page starts to create the zip, you will need to output the "building zip, please wait..." because nothing will get outputed to the browser until PHP has finished.

      Then, after the zip is made, you can just redirect the browser to the file, which will cause for that download window to pop-up. Page could look comehting like this:

      <head>
      <body>

      <?
      function Default()
      {
      echo "please wait while the zip is created";
      echo "document.location.href='thispage.php?Director=Download';";
      }

      if ($_GET[Director] == "Download")
      {
      all the commands to create the zip file
      echo "document.location.href='location/of/zipfile.zip';";
      }
      else
      {
      Default();
      }

      </body>
      </head>


        Write a Reply...