I'm extracting server side .zip using this:
<?php
$unzip = shell_exec("unzip zipp1.zip");
?>
It's working fine, but it doesn't overwrite existing files (and I need it!).
Everything is in the same folder, chmod 777.
Can I add something to fix? Tnx!
If you really need to use shell, you can write unzip -o zipp1.zip
.
However, PHP has a library for working with Zip archives, called ZipArchive
: http://php.net/manual/en/class.ziparchive.php
There you can extractTo
which overwrites by default: http://php.net/manual/en/ziparchive.extractto.php
It's usually a good security practice to disable shell_exec()
, so using PHP's libraries is recommended.