Extract ZIP-file to ftp-server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Xilo
Forum Newbie
Posts: 1
Joined: Thu Jun 14, 2007 3:36 am

Extract ZIP-file to ftp-server

Post by Xilo »

For one of our projects, we need to export a folder structure from the ftp-server (linux) to a PC and import folder structures to the ftp-server.
We decided to work with zip(using PclZip --> http://www.phpconcept.net/pclzip/index.php ) to export and import the folders automatically.
We are able to export the zip file and we can put a zip file from a PC to the ftp-server.

The problem is when we import the zip file and extract it on the server, we do not have write permissions on the folders.
We do have write permission on the files in these folders using this code:

Code: Select all

require_once("pclzip.lib.php"); 	// Read the class
		
$zip = new PclZip("$web_location");	                             //select the zip that we imported to the server
if($zip->extract(PCLZIP_OPT_SET_CHMOD, 0777) == 0)      //extract the zip with permission 0777 (all users can read, write and execute the files)
     die("Error : " . $zip->errorInfo(true));
This is the only function in the class that can change the permissions but it only affects the files in the folders, not the folders. This way, we cannot
change/delete the content of the files. We contact the creater of this class and he says that the permission-code should also affect the folders, but it doesn't.

We also tried another method using GZip ( http://www.php.net/zlib ). We have thesame problem using this.

Would anyone know if this problem occurs because our ftp-server just can't work with this and if not, is there another way
to put folder structures from a PC to a ftp-server?
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

One more unzip script

Post by Gente »

I have one more unzip script. You can try it. Provide your email and I'll send it if you want.
Post Reply