PDA

View Full Version : Getting data as zipped format using PHP




acidity
Oct 1, 2007, 12:19 PM
Hello

Here is my table structure

document_name,
document_meta_data for searching,
document_content

So I need to allow a user to fetch documents based on various meta data information. Corresponding documents are BLOB data each with 1-2MB of text.

Once a user does a search I show him a list of names. I dont query the document_content as its not required.

Now, I have to provide an option where I allow the user to download all the DOCUMENT_CONTENT returned by the query as a zip file.

Basically, I want to query the database get the result, make a temporary ZIP or TAR GZ file at the server which is allowed for downloading and once the user downloads the file its deleted from the server.

How should I approach this problem? Pointers to info would be appreciated.



macfaninpdx
Oct 1, 2007, 03:25 PM
How should I approach this problem? Pointers to info would be appreciated.

Does this link (http://us.php.net/manual/en/ref.zip.php) help?

acidity
Oct 1, 2007, 11:29 PM
Yes, definitely. Thanks a lot.

One more question, what would be the best method to delete those temporary zip files that I created to download?

Run a cron job after every five minutes to delete the zip files?