note 86103 modified in function.ziparchive-extractto by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.