Reputation: 826
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';
}
Upvotes: 0
Views: 1139
Reputation: 3503
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/') {
...
}
Upvotes: 1