NYCPHP Meetup

[nycphp-talk] Asynchronous downloads -- how?

Kenneth Downs ken at secdat.com
Wed Sep 5 15:59:38 EDT 2007


Dan Cech wrote:
> Kenneth Downs wrote:
>   
>> Let's say you have a link on a page,
>> www.example.com/friendly-url/file.mp3, which is actually being handled
>> by a PHP file that checks for subscription status and then sends the
>> file.  It looks like a straight download to the user.  So far so good.
>>
>> Now let's say the file is 50MB, so that a download will take several
>> minutes.
>>
>> When the user initiates the download, and then attempts to go to another
>> page on the site, they cannot.  All access to the site is waiting until
>> the download completes.
>>     
>
> This may be an over-simplification, but are you using
> session_write_close() after the authentication phase is complete?
>   

Dan, I owe you a beer.  That was it.

> If the session is still active during the download, other requests with
> the same session id will hang while php waits for your download script
> to release the lock on the session file.
>
> Calling session_write_close() will end the session and relinquish the
> locks, allowing your other scripts to run.
>
> Dan
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>   


-- 
Kenneth Downs
Secure Data Software, Inc.
www.secdat.com    www.andromeda-project.org
631-689-7200   Fax: 631-689-0527
cell: 631-379-0010

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070905/228b3392/attachment.html>


More information about the talk mailing list