This is what I've got so far. I need to be able to apply 0666 to all the files in the archive. Can't I do that as I am exporting? What is a sample code for changing the chmod during unarchiving or after unarchiving?
$zip = new ZipArchive;
if ($zip->open('upload/'. $username . $file_ext) === TRUE) {
$zip->extractTo('dir/' . $username);
$zip->close();
} else {
echo 'failed';
}
Thanks for all of the help! Brandon
Setting 0666
on directories might not be what you want ;-)
File creation in any process in Linux will use with 0777
for directories and 0666
for files but it depends on the umask
value what the final permissions will be. By default the umask
value is 0022
which creates files like 0644
; it works like a subtraction.
So by resetting the umask
to 0 you probably get what you need.
umask(0);
$zip = new ZipArchive;
if ($zip->open('upload/'. $username . $file_ext) === TRUE) {
$zip->extractTo('dir/' . $username);
$zip->close();
} else {
echo 'failed';
}