I am trying to extract a ZipArchive
to 'http://localhost/MODULES/ZIP_RAR_MANAGER/'
.
No errors are shown, and I get the message Zip File Opened
.
Why are the files not being correctly extracted from the zip archive?
$zip = new ZipArchive;
if ($zip->open('../test.zip'))
{
echo 'ZIP FILE OPENED...<br/>';
if ($zip->extractTo('http://localhost/MODULES/ZIP_RAR_MANAGER/'))
{
echo 'ZIP FILE EXTRACTED';
}
$zip->close();
}
else
{
echo 'failed';
}
You are trying to extract it to non-existent folder http://localhost/MODULES/ZIP_RAR_MANAGER/
. You cannot use url as a folder/file path.
You should use:
if ($zip->extractTo($_SERVER['DOCUMENT_ROOT'] . '/MODULES/ZIP_RAR_MANAGER/') {
...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.