note 92067 added to ref.zip
| From: | Anonymous at osu1 dot php dot net | Date: | Tue, 07 Jul 2009 17:42:52 +0000 |
| Subject: | note 92067 added to ref.zip | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158026@lists.php.net to get a copy of this message | ||
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?
----
Server IP: 187.16.23.134
Probable Submitter: 143.107.160.252
----
Manual Page -- http://www.php.net/manual/en/ref.zip.php
Edit -- https://master.php.net/note/edit/92067
Del: integrated -- https://master.php.net/note/delete/92067/integrated
Del: useless -- https://master.php.net/note/delete/92067/useless
Del: bad code -- https://master.php.net/note/delete/92067/bad+code
Del: spam -- https://master.php.net/note/delete/92067/spam
Del: non-english -- https://master.php.net/note/delete/92067/non-english
Del: in docs -- https://master.php.net/note/delete/92067/in+docs
Del: other reasons-- https://master.php.net/note/delete/92067
Reject -- https://master.php.net/note/reject/92067
Search -- https://master.php.net/manage/user-notes.php