On Wed, Apr 16, 2008 at 7:37 AM, Thiago Pojda <
[EMAIL PROTECTED]> wrote:

> {Top Posting}
>
> I don't know if I'm just lazy or stupid (or both).
>
> I went into a similar issue few weeks ago and my solution was to add a
> function to delete files created in the last X hours (mine was 24), and
> call
> it on the same script that creates the files.
>
> Which means it tries to clean up old files every time it creates a new
> one.
>
> Is that any good for you guys?


it sounds like thats what theyre talking about doing...

i was thinking, maybe put something in the session.  a variable to indicate
the file was generated for some page.  so like, on the page that the clip is
produced for, you drop a value in the session.  maybe a path to the file;
and that would go in some array index like
$_SESSION['lastSoundByte']
so then, at the beginning part of the logic for building a page you include
something along the lines of
if(!empty($_SESSION['lastSoundByte'])) { unlink($_SESSION['lastSoundByte']);
}

that way, you could get rid of them almost as quickly as they are created;
you wont be overwriting any files for different users, and you have the
garuantee that the sound bytes will no longer be required for use by the
clients.  because theyve gone to another page ;)  and you eliminate any
issue about knowing when the file has been completely downloaded by the
client.

i would still consider a cron as a cleanup script tho...

-nathan

Reply via email to