Jump to content

How to zip a full directory? Also ... unzip structure of an uploaded zip file.


adrianTNT

Recommended Posts

Can someone please point me in the right direction with this?

I am trying to create two things/codes.

 

- I have files placed like this in directories: "/files/103/", "/files/104/", "/files/105/"

The directories have multiple files and directories in them.

Is there a simple function to create a zip "104.zip" that contains all the files and folders in that directory keeping the directory structure?

 

- The other thing... users upload a zip by a form, is there a function to unzip an uploaded zip in a given directory (files/104/) keeping the directory structure from the zip?

 

Maybe there is a class or something for this?

Any ideas? Thank you.

This would be a push in the right direction:

 

http://no.php.net/zip

 

Scroll down to the examples - they describe pretty much everything :)

 

http://www.phpit.net/article/creating-zip-tar-archives-dynamically-php/

 

A tutorial found by Google.com -> php zip tutorial

I found many examples for the unzip thing, but the 1st issue remains, I didn't find a code sample to zip all files and folders from one given location. I tried 6-7 versions, most of them link to external files or to 10 other libraries.

I do not know why people complicate things with thousands of lines, all I want is to zip a folder :(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.