You are here: Re: download all files in a directory « All PHP « IT news, forums, messages
Re: download all files in a directory

Posted by -Lost on 07/04/06 21:22

"darren" <groups@darrenludlam.plus.com> wrote in message
news:1152042641.253663.292910@m73g2000cwd.googlegroups.com...

> I have the following code that displays files and directoies within a
> directory and display the thumbnail exif data if it exists. And
> everybody was happy with that for a few hours.
>
> Now I have been asked to add a button that downloads the files in the
> directory and I can't quite get my head round it.
>
> Could someone point me in the right direction please.

The Zip (or Tar) PEAR package. Archive_Zip or Archive_Tar. If I am correct, File_Archive
is much better (I am guessing based on the fact it handles both ZIP and TAR and more).

Quick and dirty example...

/*
// Assuming PEAR directory is /something/
*/
include('Archive/Zip.php');

$zip = new Archive_Zip('all_the_files.zip');

$list = array('pic1.jpg', 'pic2.jpg'); // populate the array with your directory contents.

if ($zip->create($list))
{
print 'Your ZIP is ready.';
}

Then push the ZIP file to the browser using header (do not forget Content-Disposition).

Hope this helps.

-Lost

 

Navigation:

[Reply to this 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

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