The Zip Processor PHP provides industry-standard Zip archive functionality.
It is designed to be easy to use. You can pack/unpack a file or folder
without a single line of code. If you need to create or extract Zip
files automatically, this extension is for you. Combined with Pure PHP Upload 2,
your users can upload Zip files directly! Use form fields to allow the
user to select his/her own files to be compressed in a new zip file for
direct download. You can even Zip a complete folder to, for example,
create a backup of your site.
You don't need to write any additional code or install server components; it runs on PHP 4 and PHP 5.
Zip Processor PHP 3.0 Manual
The Basics: Automatically Zip an Uploaded File and Download it
Introduction
In this tutorial we will explain how to automatically zip and download a file that has been uploaded with the Pure PHP Upload 2 extension.
How to do it
1. Define your site in Dreamweaver and Create
a new page
Define your site in Dreamweaver and choose the
option to create an PHP page, you can read more about this at this page.
You should open a new page in Dreamweaver or use an existing one.
2. Create a Pure PHP Upload File Field
Create a form, add a file field and add the Pure PHP Upload 2 Server Behavior to the file field. Make sure you have the proper access rights to
the server to be able to upload files. Add a submit button.
3. Select the
Server Behavior
Add the Zip Processor 3.0 server behavior.
4. Set the Zip Processor 3.0 Options
After selecting the Zip Processor 3.0 Server Behavior a new popup appears:
Leave the default Name that is used to identify the behavior.
Select the Pure Upload as our Source and set it to *** All
Files as we want to upload all of the files in the form.
Select the Zip action to zip the files after they are uploaded. Choose
the Filename and set it to any name you like. You can also generate a
dynamic name by pressing the lightning bolt icon.
In our example we'll add an additional read me file in the zip that is created
by selecting it with the browse button from the Additional File field. Check
the Move Files To Zip to delete the original file. Optionally you can check
the Download Zip option to receive a zipped version of the uploaded
file.
If you haven't selected the Download Zip option, you have to set the Destination for the zipped file and make sure you have the proper access rights on your
server. We check the Overwrite option to overwrite zip files with the
same name. If we leave this option unchecked, any new files will be added to
the already existing zip. We set the Allowed Files to All (you can
restrict the files that are to be extracted by type by using the dropdown menu
by setting it to Customize… you can use the Extensions field to specify
the file type).
Press OK to apply your settings.
5. Save and done
Save your page and upload it to your server,
and you are done! Go to your website and test it - you should be able to upload
any file.