note 86103 modified in function.ziparchive-extractto by felipe

From: Date: Sat, 04 Oct 2008 16:45:03 +0000
Subject: note 86103 modified in function.ziparchive-extractto by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145056@lists.php.net to get a copy of this message
Make attention when using this function with apache & windows system. Windows file system use \ (backslash) instead of unix / (slash) Use str_replace like this. <?php $zip = new ZipArchive; if ($zip->open("file.zip")){ $path = getcwd() . "/dirToextract/"; $path = str_replace("\\","/",$path); echo $path; echo $zip->extractTo($path); $zip->close(); echo 'Done.'; } else { echo "Error"; } ?> --was-- Make attention when using this function with apache & windows system. Windows file system use \ (backslash) instead of unix / (slash) Use str_replace like this. <?php $zip = new ZipArchive; if ($zip->open("file.zip)){ $path = getcwd() . "/dirToextract/"; $path = str_replace("\\","/",$path); echo $path; echo $zip->extractTo($path); $zip->close(); echo 'Done.'; } else { echo "Error"; } ?> http://php.net/manual/en/function.ziparchive-extractto.php

« previous php.notes (#145056) next »