note 92067 deleted from ref.zip by thiago

From: Date: Tue, 07 Jul 2009 17:45:49 +0000
Subject: note 92067 deleted from ref.zip by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-158027@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- I'm trying to unzip a file, but the routine I'm using unzip other files unless the one that I really want to unzip. Here is the routine I'm using: $zip = zip_open($nome_file); if($zip){ while ($zip_entry = zip_read($zip)) { zip_entry_open($zip, $zip_entry); if (substr(zip_entry_name($zip_entry), -1) == '/') { $zdir = substr(zip_entry_name($zip_entry), 0, -1); if (file_exists($zdir)) { trigger_error('Directory "<b>' . $zdir . '</b>" exists', E_USER_ERROR); return false; } mkdir($zdir); } else { $name = zip_entry_name($zip_entry); chdir('upload'); if (file_exists($name)) { trigger_error('File "<b>' . $name . '</b>" exists', E_USER_ERROR); return false; } $fopen = fopen($name, "w"); fwrite($fopen, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)), zip_entry_filesize($zip_entry)); } zip_entry_close($zip_entry); } zip_close($zip); return true; } else{ echo "Falha ao abrir"; } Does anybody know why this doesn't work?

« previous php.notes (#158027) next »