Page 1 of 1

keep surfing while forcing a download

Posted: Tue Oct 04, 2005 7:36 am
by prima-nocte
the title isn't very clear i admit that but didn't know a nice and snappy title ;)

I have a membersection on my website where people can download movies.
I serve these movies with:

Code: Select all

header("Cache-control: private");
header("Content-type: application/x-download");
header("Content-Disposition: attachment; filename=$downloadmovie;");
header("Accept-Ranges: bytes");
header("Content-Length: $download_size");
readfile($file_server_path);
no problems. all works fine. But while you are downloading you can't surf further on the website. The movies are about 500 Mb each so i would like it for our customers that they can proceed navigating our website while downloading the movie in the background. Or at least have two downloads at the same time.

Anybody have any idea why the website stops while downloading? As soon as i cancel the download the website loads fine again. But while downloading a movie everything stops.
Thanks

Posted: Tue Oct 04, 2005 7:57 am
by feyd
I believe most often this is more due to an individual's browser.. but it can be affected by how you initiate the download.. for instance, in a popup or something..

Posted: Wed Oct 05, 2005 8:04 am
by prima-nocte
i tried opening the page in different browsers and in a _blank window and with window.open.. everything.. but still nothing.

Does the php process stay alive while downloading? or does he just serves the file and then backs off?

Posted: Wed Oct 05, 2005 8:11 am
by feyd
the thread/process stays active for as long as is needed to load and send the entire file.

Posted: Wed Oct 05, 2005 8:30 am
by prima-nocte
damn.. that aint good :s.. is there any other way of serving protected files where the php proces doesn't stay active while downloading that you're aware of?
All the files are in a htaccess protected folder so i need to serve them with php.. but this is not so good...

Posted: Wed Oct 05, 2005 8:37 am
by feyd
your web server can run mutliple instances of php concurrently.. otherwise only one person could be looking at a page at any given, which is quite useless for a web server now isn't it? ;)

It may be a host configured thing that is outside your control. For instance, maybe they set a limit as to how much a particular visitor can occupy the CPU, or that they only allow a visitor to request from one page at a time..

Posted: Wed Oct 05, 2005 8:58 am
by prima-nocte
any idea what that setting might be? ;) .. i have full control over te server so i should be able to alter it