Reply to Re: A follow-up to my download-all-files-as-a-zip-file post

Your name:

Reply:


Posted by Rik on 08/05/07 01:52

On Sun, 05 Aug 2007 03:29:38 +0200, <techusky@gmail.com> wrote:

> I made a script that successfully creates a .zip file of all the files
> in a directory on my web server, but now what I haven't figured out
> how to do is how to have it automatically deleted when the user
> successfully downloads it, as otherwise my server would eventually get
> clogged up with all these zip files.
>
> Any help/suggestions?

If you're serving it using PHP itself, a construct _might_ be possible by
using ignore_user_abort() and checking the connection_status() at the end
(after all data is sent), and unlink the file if there's been no abortion.
However, ths smaller the file, the less trustworthy it becomes (Think of
the UA: you ask to download, you abort, but if it's allready in, the
connection was succesfull. Now try to download it again, and it's
gone...). If all is reproducable (i.e. the original files/data remains,
only the zip files need to be cleaned up) the only problem is wasted
resources. If you're deleting data you can't get again it's not wise to
delete anything unless you're really, really sure.

This has been discussed in this group thoroughly a few months ago, try to
search the archives. I think the ignore_user_abort/unlink functions are
mentioned in it, so it's a place to start searching.

From the top of my head, I think the final solution was it's better to ask
for a user confirmation, and temporary clean old files up using a cron job.
--
Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация