Hello Joshua, On 9 Feb 2004 at 15:45, Joshua Minnie wrote:
> Does anybody have any idea to allow for multiple downloads while another > one was going on. Maybe some additional headers? I have tried adding > headers before and after where I open the file for HTTP/1.1 200 OK and the > corresponding headers. I have also tried using a simple meta refresh, but > that doesn't work because it won't refresh until the page is entirely > loaded. > > I am at a loss, I can't seem to find answer when I google it either. > Maybe I'm just missing something. I don't know. The same script can only send headers to the browser once each time it's loaded. In other words, after a script has been parsed and the page has been loaded, it cannot send more headers to the browser unless you reload it. Since in your case the same script (i.e. same page) does everything, it can only handle one download at a time; that's basically what I think you're missing. A simple solution is to have each download link call a *separate* script (i.e. another page) whose sole purpose is to take care of generating the download, i.e. sending the headers and the file to the user's browser. Think about how ZDNet or Tucows, for example, work: first you choose the file you want to download from a menu (the main download page, which doesn't actually generate the downloads), and then when you click on the download link you're taken to a new page (the one that actually takes care of the download) that tells you to wait a few seconds until the download starts. If you're concerned about security (i.e. unauthorized users downloading files by accessing the actual download script directly without going through the page where they see the file list etc.), you can use some kind of random authorization code that is sent by the main download script via a GET string to the actual download page. That way, if the right authorization code is not received by the script on the page that generates the headers and sends the file to the browser, the download will fail. (Note that I suggested a GET string because you cannot normally start sessions before sending headers to the browser, as session_start() will itself send headers. But you can always play with output buffering if you like.) Hope this helps, Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php